This document discusses using SignalR to enable real-time communication between clients and servers. SignalR allows for bidirectional communication through features like hubs and persistent connections. It works across browsers and devices by using techniques like websockets, server-sent events, and long polling. SignalR provides security through connection tokens and supports performance at scale through backplanes like Azure Service Bus. In conclusion, SignalR is a library that enables real-time applications by facilitating client-to-server and server-to-client communication with broadcasting capabilities and low latency.
10. What we can use?
• Commet
• Pusher
• SockJS
• SocketIO
• Faye
• Now.js
• Sse
• Django-sse
• Cramp
11. What we can use?
• Commet
• Pusher
• SockJS
• SocketIO
• Faye
• Now.js
• Sse
• Django-sse
• Cramp
SignalR
12. What is SignalR?
• Async library for .NET to help build real-time,
multiuser interactive web applications
• Bidirectional communication
• Open Source
• Adopted by Microsoft
• GitHub
13. When we can use it?
• Server
• Windows (.NET)
• Mono
• Clients
• Chrome
• Firefox
• Safari
• IE
• Opera
• Android browser
• IoS
• Windows Desktop
• Silverlight
• Windows Store
• Windows Phone
• and old browsers
16. Hubs
• Over Connections
• Share variables
• Calls between client and server
• Serialization
• Capture connect/disconnect
• Everything works by magic
17. Hubs
• When you have multiple hubs
• Same connection is shared by a client
• Groups are maintain separately for each hub
• One proxy JS file for all hubs
• Async support
• OnConnected
• OnDisconnected
• OnReconnected
• proxy.State (JS) & Client.Caller (C#)
18.
19. Hubs vs Persistent
Connections
Hubs
• Remote invocation
Persistent Connections
• Message format needs
to be specified
• Messaging and
dispatching model
• An existing app is
ported to SignalR
20. Security
• Based on Connection Token (Connection Id + Username)
• Unique
• Managed by server
• Encrypted with a digital signature
• Connection Id
• Exist until the end of connection
• Username
• Only for authenticated users
• Passed between client and server for each request
21.
22.
23. CSRF and SignalR
• Disable cross domain requests
• Verify connection token
• Put connection token query string
• The connection token is not persisted on the client
24. Performance
• Single Box
• Over 450.000 messages per second
• 15.000 – 20.000 connection (hardware limitations –
ports)
• Web farm
• You have “NO” limit
• You need to synchronize each node from the farm
25.
26.
27.
28. SignalR Farm
• Backplanes:
• Windows Azure Service Bus
• Redis
• SQLServer
• Server broadcast
• High-frequency realtime
• Client to client
29.
30. Conclusion
• SignalR
• Client to Server
• Server to Client
• Broadcasting
• Real Time application
• Scalable
• Low latency