SlideShare a Scribd company logo
1 of 40
Alex Konduforov
About me
 Live in Kharkov
 Work at AltexSoft
 Blogger (merle-amber.blogspot.com)
 Speaker at different conferences

and .NET user groups
 Kharkov AI club co-organizer
Web evolution
Event-based, real-time UI

Partial page updates (Ajax), RIA

Dynamic pages, forms

Static HTML pages
Users Want the
Latest Info
NOW!
Social networks
Auctions
Stock tickers
Web chats
Other applications
 Live scores
 Real-time notifications
 Interactive games
 Collaborative apps

 Live user analytics
 etc.
Standard solutions
 Frequent Polling
 Long polling
 Server-Sent events (HTML5)
 WebSocket (HTML5)
Polling
 Get updates frequently using Ajax requests

Pros:
 --Cons:
 Delay in results
 Wastes bandwidth & latency
Long polling
 Similar to usual polling (Ajax requests)
 Request waits longer (1-2 minutes)

Pros:
 Lower load on server
 No delays
Cons:
 Consumes server threads & connection resources
Server-Sent events
 HTML5, works over HTTP
 EventSource JavaScript API
 Content-type: text/event-stream

Pros:
 No need to reconnect
 No need in a special protocol or server implementation
Cons:
 Works in server-t0-client direction
WebSocket
 HTML5, new protocol (ws:// and wss://) on top of TCP

Pros:
 Full-duplex persistent connection (both ways)
Cons:
 Require Web Socket protocol support on client (IE10)
 Require Web Socket protocol support on server (IIS8)
What to do?
WebSocket

Best solution

Not supported on all
browsers and server

Server-Sent events + Very good
Ajax to send data
Long Polling
Not so good

Not supported in IE
(damn!)
Supported everywhere

Mix

Do I need to implement
it on my own???

Very good
Superman SignalR to the rescue!
Authors

Damian Edwards

David Fowler
What is SignalR?
 Official MS technology to build real-time multi-user

ASP.NET applications: http://signalr.net/
 Out-of-box solution that consists of server and client
side
 Abstraction over the set of transports
 Open-source solution available on GitHub that can be
installed via NuGet
Transports priority
WebSockets

Server-Sent events

Forever Frame (IE hack)

Long Polling
Architecture
Client side
JS, .NET/WinRT, WP, Silverlight, iOS/Android

Hub API

PersistentConnection API
Hubs
 High-level API

 Similar to Controller (actions, thread per call)
Supported scenarios
 Client calling the server
 Server calling clients (all, group, one)
 State round-tripping between client and server
 Binding complex objects (JSON)

 Detecting connect, disconnect and reconnect clients
 Broadcasting from outside of a Hub
 Async scenarios (return Task/Task<T> to client)
Server calling the client
 dynamic Clients property

 JSON serialization
Managing Groups
 Add/remove connections to groups
Broadcasting from outside
 Notify clients from another server-side code
JavaScript client
 $.connection.hub


connection for all hubs (url points to /signalr)

 $.connection.hub.id


client id for the hub connection

 $.connection.hub.start()


starts the connection for all hubs

 $.connection.{hubname}


access a client side hub from the generated proxy
Exposing methods on the client
 The JavaScript client can declare methods that the

server can invoke:
 myHub.{method} = callback
 declares a function the server can invoke.
 method - name of the client side method
 callback - function to execute when the server invokes
the method
JavaScript example
Asynchronous execution
DEMO
Authentication
 Uses ASP.NET authentication mechanisms
 Provides the Authorize attribute for Hubs
 Forms and Windows authentications

 Certificates are available as well
Authentication
 Connection token uniquely identifies clients
Security
 Cross-Site Request Forgery (CSRF) prevention
 Disable cross domain requests
 Pass connection token in query string, not cookie
 Verify connection token
 If authenticated user changes,

SignalR requires a re-connection
Configuring SignalR
Set in IConfigurationManager:
Settings

Description

ConnectionTimeout amount of time to leave a connection
open (110 sec default)

Default value

110 seconds

DisconnectTimeout

amount of time to wait after a
20 seconds
connection goes away before raising the
disconnect event

HeartBeatInterval

interval for checking the state of a
connection

KeepAlive

amount of time to wait before sending a 30 seconds
keep alive packet over an idle
connection. Set to null to disable keep
alive

10 seconds
SignalR and web farm
 Azure Service Bus
 Windows Server Service Bus
 SQL Server
 Redis
SignalR over Redis
 Step 1


Download and install Redis as Windows service

 Step 2


Install-Package SignalR.Redis

 Step 3
New features in v2.0
 .NET 4.5 only!
 iOS and Android support via Xamarin
 Portable .NET clients
 Self hosting package
 Backwards compatibility server support

 Cross domain support
 Easier unit testing
 JavaScript error handling

 New HubException exception
Safe to use?
 Version 2.0 released
 Dynamically evolving
 Proven and stable technology
 Used in many real-time .NET applications

 Open-source
Materials
 https://github.com/SignalR
 http://jabbr.net
 http://www.hanselman.com/blog/CategoryView.aspx?cate

gory=SignalR
 http://www.asp.net/signalr/overview/signalr-20
 http://merle-amber.blogspot.com/2012/11/real-timeaspnet-signalr.html
Thanks for listening!
 merle-amber.blogspot.com
 aikharkov.wordpress.com
 @konduforov

31337

More Related Content

What's hot

Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsAkshay Mathur
 
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018Scrum Breakfast Vietnam
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS appAleks Zinevych
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot ApplicationsVMware Tanzu
 
Rate Limiting with NGINX and NGINX Plus
Rate Limiting with NGINX and NGINX PlusRate Limiting with NGINX and NGINX Plus
Rate Limiting with NGINX and NGINX PlusNGINX, Inc.
 
Building layers of defense for your application
Building layers of defense for your applicationBuilding layers of defense for your application
Building layers of defense for your applicationVMware Tanzu
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVCDzmitry Naskou
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
 
Testing RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkTesting RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkMicha Kops
 
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...KMS Technology
 
Test your microservices with REST-Assured
Test your microservices with REST-AssuredTest your microservices with REST-Assured
Test your microservices with REST-AssuredMichel Schudel
 

What's hot (20)

Maven
MavenMaven
Maven
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
 
Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS app
 
Testing Spring Boot Applications
Testing Spring Boot ApplicationsTesting Spring Boot Applications
Testing Spring Boot Applications
 
Rate Limiting with NGINX and NGINX Plus
Rate Limiting with NGINX and NGINX PlusRate Limiting with NGINX and NGINX Plus
Rate Limiting with NGINX and NGINX Plus
 
Building layers of defense for your application
Building layers of defense for your applicationBuilding layers of defense for your application
Building layers of defense for your application
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Rest assured
Rest assuredRest assured
Rest assured
 
Postman
PostmanPostman
Postman
 
Google Firebase presentation - English
Google Firebase presentation - EnglishGoogle Firebase presentation - English
Google Firebase presentation - English
 
Express node js
Express node jsExpress node js
Express node js
 
Angular
AngularAngular
Angular
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Testing RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured frameworkTesting RESTful Webservices using the REST-assured framework
Testing RESTful Webservices using the REST-assured framework
 
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
 
API
APIAPI
API
 
Test your microservices with REST-Assured
Test your microservices with REST-AssuredTest your microservices with REST-Assured
Test your microservices with REST-Assured
 

Viewers also liked

Real time websites and mobile apps with SignalR
Real time websites and mobile apps with SignalRReal time websites and mobile apps with SignalR
Real time websites and mobile apps with SignalRRoy Cornelissen
 
ASP.NET, MVC, ASP.NET MVC
ASP.NET, MVC, ASP.NET MVCASP.NET, MVC, ASP.NET MVC
ASP.NET, MVC, ASP.NET MVCGetDev.NET
 
Redis: возможности, выгоды, примеры использования
Redis: возможности, выгоды, примеры использованияRedis: возможности, выгоды, примеры использования
Redis: возможности, выгоды, примеры использованияAlexey Kachayev
 
ELEIÇÕES 2012 - ASTORGA: Toninho 31123
 ELEIÇÕES 2012 - ASTORGA: Toninho 31123 ELEIÇÕES 2012 - ASTORGA: Toninho 31123
ELEIÇÕES 2012 - ASTORGA: Toninho 31123Joao Carlos Passari
 
Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)brendankowitz
 
Building Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRBuilding Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRShravan Kumar Kasagoni
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NETAlessandro Giorgetti
 
SignalR. Code, not toothpaste - TechDays Belgium 2012
SignalR. Code, not toothpaste - TechDays Belgium 2012SignalR. Code, not toothpaste - TechDays Belgium 2012
SignalR. Code, not toothpaste - TechDays Belgium 2012Maarten Balliauw
 
Introduction to Asp.net 3.5 using VS 2008
Introduction to Asp.net 3.5 using VS 2008Introduction to Asp.net 3.5 using VS 2008
Introduction to Asp.net 3.5 using VS 2008maddinapudi
 
Module 4: Introduction to ASP.NET 3.5 (Material)
Module 4: Introduction to ASP.NET 3.5 (Material)Module 4: Introduction to ASP.NET 3.5 (Material)
Module 4: Introduction to ASP.NET 3.5 (Material)Mohamed Saleh
 
Asp.net Training at NCrypted Learning Center
Asp.net Training at NCrypted Learning CenterAsp.net Training at NCrypted Learning Center
Asp.net Training at NCrypted Learning CenterNCrypted Learning Center
 
Module 4: Introduction to ASP.NET 3.5 (PowerPoint Slides)
Module 4: Introduction to ASP.NET 3.5 (PowerPoint Slides)Module 4: Introduction to ASP.NET 3.5 (PowerPoint Slides)
Module 4: Introduction to ASP.NET 3.5 (PowerPoint Slides)Mohamed Saleh
 

Viewers also liked (20)

NLP Project Full Cycle
NLP Project Full CycleNLP Project Full Cycle
NLP Project Full Cycle
 
SignalR
SignalRSignalR
SignalR
 
Real time websites and mobile apps with SignalR
Real time websites and mobile apps with SignalRReal time websites and mobile apps with SignalR
Real time websites and mobile apps with SignalR
 
ASP.NET, MVC, ASP.NET MVC
ASP.NET, MVC, ASP.NET MVCASP.NET, MVC, ASP.NET MVC
ASP.NET, MVC, ASP.NET MVC
 
Redis: возможности, выгоды, примеры использования
Redis: возможности, выгоды, примеры использованияRedis: возможности, выгоды, примеры использования
Redis: возможности, выгоды, примеры использования
 
ELEIÇÕES 2012 - ASTORGA: Toninho 31123
 ELEIÇÕES 2012 - ASTORGA: Toninho 31123 ELEIÇÕES 2012 - ASTORGA: Toninho 31123
ELEIÇÕES 2012 - ASTORGA: Toninho 31123
 
Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)Real time web applications with SignalR (BNE .NET UG)
Real time web applications with SignalR (BNE .NET UG)
 
Building Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRBuilding Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalR
 
«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET«Real Time» Web Applications with SignalR in ASP.NET
«Real Time» Web Applications with SignalR in ASP.NET
 
SignalR
SignalRSignalR
SignalR
 
SignalR. Code, not toothpaste - TechDays Belgium 2012
SignalR. Code, not toothpaste - TechDays Belgium 2012SignalR. Code, not toothpaste - TechDays Belgium 2012
SignalR. Code, not toothpaste - TechDays Belgium 2012
 
Real time web with SignalR
Real time web with SignalRReal time web with SignalR
Real time web with SignalR
 
Asp.net Mvc 5 y Azure
Asp.net Mvc 5 y AzureAsp.net Mvc 5 y Azure
Asp.net Mvc 5 y Azure
 
Introduction to Asp.net 3.5 using VS 2008
Introduction to Asp.net 3.5 using VS 2008Introduction to Asp.net 3.5 using VS 2008
Introduction to Asp.net 3.5 using VS 2008
 
Module 4: Introduction to ASP.NET 3.5 (Material)
Module 4: Introduction to ASP.NET 3.5 (Material)Module 4: Introduction to ASP.NET 3.5 (Material)
Module 4: Introduction to ASP.NET 3.5 (Material)
 
Learn ASP
Learn ASPLearn ASP
Learn ASP
 
Startups Getting Started
Startups Getting StartedStartups Getting Started
Startups Getting Started
 
Asp.net Training at NCrypted Learning Center
Asp.net Training at NCrypted Learning CenterAsp.net Training at NCrypted Learning Center
Asp.net Training at NCrypted Learning Center
 
Module 4: Introduction to ASP.NET 3.5 (PowerPoint Slides)
Module 4: Introduction to ASP.NET 3.5 (PowerPoint Slides)Module 4: Introduction to ASP.NET 3.5 (PowerPoint Slides)
Module 4: Introduction to ASP.NET 3.5 (PowerPoint Slides)
 
CUDA & CAFFE
CUDA & CAFFE CUDA & CAFFE
CUDA & CAFFE
 

Similar to Real-time ASP.NET with SignalR

Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Deepak Gupta
 
Web Services Container
Web Services ContainerWeb Services Container
Web Services ContainerJorgen Thelin
 
CTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App FabricCTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App FabricSpiffy
 
Realtime web experience with signal r
Realtime web experience with signal rRealtime web experience with signal r
Realtime web experience with signal rRan Wahle
 
AWS IoT - Best of re:Invent Tel Aviv
AWS IoT - Best of re:Invent Tel AvivAWS IoT - Best of re:Invent Tel Aviv
AWS IoT - Best of re:Invent Tel AvivAmazon Web Services
 
SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)Kashif Imran
 
Game server development in node.js in jsconf eu
Game server development in node.js in jsconf euGame server development in node.js in jsconf eu
Game server development in node.js in jsconf euXie ChengChao
 
HTML5 Server Sent Events/JSF JAX 2011 Conference
HTML5 Server Sent Events/JSF  JAX 2011 ConferenceHTML5 Server Sent Events/JSF  JAX 2011 Conference
HTML5 Server Sent Events/JSF JAX 2011 ConferenceRoger Kitain
 
New microsoft office power point presentation
New microsoft office power point presentationNew microsoft office power point presentation
New microsoft office power point presentationteach4uin
 
Windows Azure AppFabric
Windows Azure AppFabricWindows Azure AppFabric
Windows Azure AppFabricDavid Chou
 
Oauth Nightmares Abstract OAuth Nightmares
Oauth Nightmares Abstract OAuth Nightmares Oauth Nightmares Abstract OAuth Nightmares
Oauth Nightmares Abstract OAuth Nightmares Nino Ho
 
Connected Web Systems
Connected Web SystemsConnected Web Systems
Connected Web SystemsDamir Dobric
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkIoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkMirco Vanini
 
Fancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalRFancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalRVladimir Georgiev
 

Similar to Real-time ASP.NET with SignalR (20)

Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)Real time Communication with Signalr (Android Client)
Real time Communication with Signalr (Android Client)
 
Signal r
Signal rSignal r
Signal r
 
Introduction To Cloud Computing
Introduction To Cloud ComputingIntroduction To Cloud Computing
Introduction To Cloud Computing
 
Web Services Container
Web Services ContainerWeb Services Container
Web Services Container
 
CTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App FabricCTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App Fabric
 
Realtime web experience with signal r
Realtime web experience with signal rRealtime web experience with signal r
Realtime web experience with signal r
 
AWS IoT - Best of re:Invent Tel Aviv
AWS IoT - Best of re:Invent Tel AvivAWS IoT - Best of re:Invent Tel Aviv
AWS IoT - Best of re:Invent Tel Aviv
 
SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)
 
Day6
Day6Day6
Day6
 
Game server development in node.js in jsconf eu
Game server development in node.js in jsconf euGame server development in node.js in jsconf eu
Game server development in node.js in jsconf eu
 
WebSockets in JEE 7
WebSockets in JEE 7WebSockets in JEE 7
WebSockets in JEE 7
 
HTML5 Server Sent Events/JSF JAX 2011 Conference
HTML5 Server Sent Events/JSF  JAX 2011 ConferenceHTML5 Server Sent Events/JSF  JAX 2011 Conference
HTML5 Server Sent Events/JSF JAX 2011 Conference
 
New microsoft office power point presentation
New microsoft office power point presentationNew microsoft office power point presentation
New microsoft office power point presentation
 
Windows Azure AppFabric
Windows Azure AppFabricWindows Azure AppFabric
Windows Azure AppFabric
 
Oauth Nightmares Abstract OAuth Nightmares
Oauth Nightmares Abstract OAuth Nightmares Oauth Nightmares Abstract OAuth Nightmares
Oauth Nightmares Abstract OAuth Nightmares
 
Connected Web Systems
Connected Web SystemsConnected Web Systems
Connected Web Systems
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkIoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@Work
 
Webconnection
WebconnectionWebconnection
Webconnection
 
Windows Azure
Windows AzureWindows Azure
Windows Azure
 
Fancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalRFancy Features in Asp.Net Core SignalR
Fancy Features in Asp.Net Core SignalR
 

More from Alexander Konduforov

Recommender systems for E-commerce
Recommender systems for E-commerceRecommender systems for E-commerce
Recommender systems for E-commerceAlexander Konduforov
 
Machine Learning and Azure Machine Learning
Machine Learning and Azure Machine LearningMachine Learning and Azure Machine Learning
Machine Learning and Azure Machine LearningAlexander Konduforov
 
ИИ персонажей в онлайн шутере Survarium
ИИ персонажей в онлайн шутере SurvariumИИ персонажей в онлайн шутере Survarium
ИИ персонажей в онлайн шутере SurvariumAlexander Konduforov
 
Ling to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysisLing to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysisAlexander Konduforov
 

More from Alexander Konduforov (8)

Recommender systems for E-commerce
Recommender systems for E-commerceRecommender systems for E-commerce
Recommender systems for E-commerce
 
Fast data munging in R
Fast data munging in RFast data munging in R
Fast data munging in R
 
Machine Learning and Azure Machine Learning
Machine Learning and Azure Machine LearningMachine Learning and Azure Machine Learning
Machine Learning and Azure Machine Learning
 
ИИ персонажей в онлайн шутере Survarium
ИИ персонажей в онлайн шутере SurvariumИИ персонажей в онлайн шутере Survarium
ИИ персонажей в онлайн шутере Survarium
 
Design Principles
Design PrinciplesDesign Principles
Design Principles
 
New in Entity Framework 4.0
New in Entity Framework 4.0New in Entity Framework 4.0
New in Entity Framework 4.0
 
ASP.NET MVC: new era?
ASP.NET MVC: new era?ASP.NET MVC: new era?
ASP.NET MVC: new era?
 
Ling to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysisLing to SQL and Entity Framework performance analysis
Ling to SQL and Entity Framework performance analysis
 

Recently uploaded

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

Real-time ASP.NET with SignalR

  • 2. About me  Live in Kharkov  Work at AltexSoft  Blogger (merle-amber.blogspot.com)  Speaker at different conferences and .NET user groups  Kharkov AI club co-organizer
  • 3. Web evolution Event-based, real-time UI Partial page updates (Ajax), RIA Dynamic pages, forms Static HTML pages
  • 9. Other applications  Live scores  Real-time notifications  Interactive games  Collaborative apps  Live user analytics  etc.
  • 10. Standard solutions  Frequent Polling  Long polling  Server-Sent events (HTML5)  WebSocket (HTML5)
  • 11. Polling  Get updates frequently using Ajax requests Pros:  --Cons:  Delay in results  Wastes bandwidth & latency
  • 12. Long polling  Similar to usual polling (Ajax requests)  Request waits longer (1-2 minutes) Pros:  Lower load on server  No delays Cons:  Consumes server threads & connection resources
  • 13. Server-Sent events  HTML5, works over HTTP  EventSource JavaScript API  Content-type: text/event-stream Pros:  No need to reconnect  No need in a special protocol or server implementation Cons:  Works in server-t0-client direction
  • 14. WebSocket  HTML5, new protocol (ws:// and wss://) on top of TCP Pros:  Full-duplex persistent connection (both ways) Cons:  Require Web Socket protocol support on client (IE10)  Require Web Socket protocol support on server (IIS8)
  • 15. What to do? WebSocket Best solution Not supported on all browsers and server Server-Sent events + Very good Ajax to send data Long Polling Not so good Not supported in IE (damn!) Supported everywhere Mix Do I need to implement it on my own??? Very good
  • 16. Superman SignalR to the rescue!
  • 18. What is SignalR?  Official MS technology to build real-time multi-user ASP.NET applications: http://signalr.net/  Out-of-box solution that consists of server and client side  Abstraction over the set of transports  Open-source solution available on GitHub that can be installed via NuGet
  • 20. Architecture Client side JS, .NET/WinRT, WP, Silverlight, iOS/Android Hub API PersistentConnection API
  • 21. Hubs  High-level API  Similar to Controller (actions, thread per call)
  • 22. Supported scenarios  Client calling the server  Server calling clients (all, group, one)  State round-tripping between client and server  Binding complex objects (JSON)  Detecting connect, disconnect and reconnect clients  Broadcasting from outside of a Hub  Async scenarios (return Task/Task<T> to client)
  • 23. Server calling the client  dynamic Clients property  JSON serialization
  • 24. Managing Groups  Add/remove connections to groups
  • 25. Broadcasting from outside  Notify clients from another server-side code
  • 26. JavaScript client  $.connection.hub  connection for all hubs (url points to /signalr)  $.connection.hub.id  client id for the hub connection  $.connection.hub.start()  starts the connection for all hubs  $.connection.{hubname}  access a client side hub from the generated proxy
  • 27. Exposing methods on the client  The JavaScript client can declare methods that the server can invoke:  myHub.{method} = callback  declares a function the server can invoke.  method - name of the client side method  callback - function to execute when the server invokes the method
  • 30. DEMO
  • 31. Authentication  Uses ASP.NET authentication mechanisms  Provides the Authorize attribute for Hubs  Forms and Windows authentications  Certificates are available as well
  • 32. Authentication  Connection token uniquely identifies clients
  • 33. Security  Cross-Site Request Forgery (CSRF) prevention  Disable cross domain requests  Pass connection token in query string, not cookie  Verify connection token  If authenticated user changes, SignalR requires a re-connection
  • 34. Configuring SignalR Set in IConfigurationManager: Settings Description ConnectionTimeout amount of time to leave a connection open (110 sec default) Default value 110 seconds DisconnectTimeout amount of time to wait after a 20 seconds connection goes away before raising the disconnect event HeartBeatInterval interval for checking the state of a connection KeepAlive amount of time to wait before sending a 30 seconds keep alive packet over an idle connection. Set to null to disable keep alive 10 seconds
  • 35. SignalR and web farm  Azure Service Bus  Windows Server Service Bus  SQL Server  Redis
  • 36. SignalR over Redis  Step 1  Download and install Redis as Windows service  Step 2  Install-Package SignalR.Redis  Step 3
  • 37. New features in v2.0  .NET 4.5 only!  iOS and Android support via Xamarin  Portable .NET clients  Self hosting package  Backwards compatibility server support  Cross domain support  Easier unit testing  JavaScript error handling  New HubException exception
  • 38. Safe to use?  Version 2.0 released  Dynamically evolving  Proven and stable technology  Used in many real-time .NET applications  Open-source
  • 39. Materials  https://github.com/SignalR  http://jabbr.net  http://www.hanselman.com/blog/CategoryView.aspx?cate gory=SignalR  http://www.asp.net/signalr/overview/signalr-20  http://merle-amber.blogspot.com/2012/11/real-timeaspnet-signalr.html
  • 40. Thanks for listening!  merle-amber.blogspot.com  aikharkov.wordpress.com  @konduforov 31337

Editor's Notes

  1. ПредставлениеПеред тем как начать доклад, хотелось бы спросить, что вы понимаете под понятием Real-time и как это может быть применимо к веб-приложениям?Сколько людей уже пробовали SignalR?
  2. Рассмотрим развитие вебы-программирования.Веб начинался 20 лет назад со статических HTML страниц. Потом появились скриптовые серверные языки программирования, которые позволили начать создавать динамические страницы, загружать данные на сервер. Следующий значительный этап – частичное обновление страницы (AJAX), появление Rich Internet Applications. Казалось бы, вот оно, счастье. Но и это не решает всех проблем. Все, что мы рассматривали до этого – следование парадигме запрос-ответ. Сервер ничего не знает о клиентах и не может посылать им сообщения. А без этого нельзя строить по-настоящему real-time UI.Сколько людей сталкивались с задачами обеспечения real-time UI, с какими именно?
  3. Есть еще и некоторые другие примеры.
  4. Какие есть стандартные решения для перечисленных задач.Самый первый исторически появившийся – Polling, т.е. постоянное обращение на сервер за обновлениямиЗатем программисты подумали и решили, что можно держать запрос открытым подольше, чтобы не забрасывать сервер запросами – Long Polling. Добиться большего на старой спецификации HTML и HTTP было сложно.Но когда появилась спецификация HTML5, то в нее было добавлено сразу 2 механизма: Server-Sent events и WebSockets. И если о последнем уже многие слышали, то про Server-Sent events не догадываешься, пока не столкнешься с соответств
  5. Итак, использоватьWebSocketеще рано, т.к. он пока не поддерживается во всех браузерах, и даже не на всех серверах. Если вам этого достаточно – отлично, а если нет?Можно использовать Server-SentEvents + отправку данных через старый-добрый XmlHttpRequest (Ajax), но он не поддерживается в IE (слава тебе).Можно всегда использовать Long Polling, но это бОльшая нагрузка на сервер + большинство браузеров все же поддерживают SSE.Хотелось бы иметь разные решения в разных ситуациях
  6. На данный момент