2. What is SignalR?
• It’s a library for adding real-time functionality to an
application
• It’s open source, written by Microsoft Open
technologies
• Free to use under Apache 2.0. License
3. When to use SignalR
• Do you have an app that requires a page to refresh
in order to get new data ?
o Refresh data using Ajax or just a page reload
• Need to notify client(s) about new event(s) ?
• Need duplex communication?
o Ex: Real time document editing
o Chat
o Game
4. What OS is supported?
• Server
o Microsoft Windows
• Windows 7,8
• Windows Server 2008 R2, 2012
• Windows Azure
o Linux with Mono
• Clients
o WPF
o WinRT
o Windows Phone
o Silverlight
o JavaScript Client
o iOS (community supported)
5. Things to know before
deploying
• .Net Framework 4.0 & 4.5
• IIS 7.x or 8
o IIS Express is also supported
• WebSockets are supported only by IIS 8 (including
IIS8 Express)
6. Browser support
• Internet Explorer
o WebSockets (10+)
o ForeverFrame (8+)
o Long polling (8+)
• Firefox, Chrome, Safari
o WebSockets
o Server-Sent Events
o Long polling
10. Configuration explained
• To start using HubsApi (Web Client):
o Define a root that client will used to connect to our Hub class. Use
Route.Table.MapHubs() in your Application_Start method
o Default route is “/signalr”
o Route can be customized by assigning a new value to route URL:
• Server side configuration:
o RouteTable.Routes.MapHubs("/signalr", new HubConfiguration())
• JavaScript configuration:
o .connection.hub.url = "/signalr”
• Create a Hub class – a class that will allow us to call
client methods.
o Hub class must inherit form Microsoft.Aspnet.Signalr.Hub
11. Transport selection
1. WebSocket
o If IE 8 or earlier then skip step 2 & 3
o If Cross-domain request, check if client & server supports WebSocket else
use 4.
2. ServerSent Event
3. Forever Frame
4. Long Polling
5. SignalR supports custom transport selection
o Developers can specify the transport selection order
connection.start({ transport: ['webSockets','longPolling'] });
12. Things to remember
• There is no compile time validation
• Cross-Domain connection is not configured by
default
• do not use jQuery.support.cors=true
Ex: check order stats of an eCommerce appOn page customer supportGet latest tweets from your account?
Windows 8 or Windows Server 2012
Explain transport layers
Browse the code , dependencies, how solution is configured
Explain demo code
Explain transport negotiation processEx. Defined transport selection fallback -> connection.start({ transport: ['webSockets','longPolling'] }); Try use fiddler