SignalR Overview
-
Upload
michael-sukachev -
Category
Software
-
view
90 -
download
0
Transcript of SignalR Overview
SignalR Overview:
How Web Pages can get all the Real-
time Fun?
• Overview of ASP.NET SignalR
• How SignalR can be used for realtime
communications
Agenda
What is ASP.Net SignalR?
Real-time, persistent connection abstraction over HTTP
for .NET
Largest followed C# repo on GitHub
Simple and powerful API’s
Many techniques use to keep the logical connection up,
including retry logic if transports fail
Scale-out to web-farms using backplanes
Here’s some data!
Yeah, dude!
SignalR Connections
Many techniques used to maintain connection
• WebSockets
• bidirectional stream
• Server Sent Events
• Push notifications from server to browser using DOM events
• Forever Frame
• uses HTTP 1.1 chunked encoding to establish a single long-lived
HTTP connection in a hidden iframe
• Internet Explorer only
• Long Polling
• hit the server hit the server hit the server hit the server hit server
and hope something comes back with data
Clients
.NET
JavaScript
iOS
Hosts
ASP.NET
OWIN
Backplanes
SQL
Service Bus
Redis
TransportInternet
Explorer
Chrome
(Windows or
iOS)
FirefoxSafari
(OSX or iOS)Android
WebSockets 10+ current - 1 current - 1 current - 1 N/A
Server-Sent
EventsN/A current - 1 current - 1 current - 1 N/A
ForeverFrame 8+ N/A N/A N/A 4.1
Long Polling 8+ current - 1 current - 1 current - 1 4.1
Web API
Controll
er
SignalR
Hub
Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext<MessageHub>()
.Clients.All.onMessageReceived(message);
PersistentConnection And Hub
The two primary components in SignalR are hubs and
persistent connections.
Connection persistence is how the server can
communicate with one or more clients.
The vehicle to communicate with clients is a hub.
Clients.All.doWork()Clients.Caller.doWork()Clients.Others.doWork()
PersistentConnection
- Easiest implementation
- Has to have message type embed in the payload
to support different types of messages with different
payloads.
Hub – RPC over a connection
- Allows call methods on the client from the server
and from the server to the client
- Allows to pass strongly typed parameters to
methods
PersistentConnection Vs Hub
Scale-Out
Web Nodes
Clients
Backplane
Back
pla
ne
Scale-Out
Three options for deploying backplane
- Service Bus
- SQL Server
- Redis
Open source in memory database that persists on disk
Requires libraries from the GitHub project currently not
in Microsoft SignalR
SignalR Demo
SignalR Examples
JabbR
http://jabbr.net
ShootR
http://shootr.signalr.net
Resources
ASP.NET SignalR
http://signalr.net
http://www.asp.net/signalr
BUILD
http://www.buildwindows.com/
3-034 - Building Real-time Web Apps with ASP.NET SignalR