Real-time fluent
communication using
SignalR and Cloud
Radu Vunvulea
vunvulear@gmail.com
http://vunvulearadu.blogspot.com
{
“name” : “Radu Vunvulea,
“company” : “iQuest”,
“userType” : “enthusiastic”
“technologies” : [ “.NET”, “JS”, “Azure”, “Web”,
“Mobile”, “SL” ],
“blog” : “vunvulearadu.blogspot.com”,
“email” : ”vunvulear@gmail.com”,
“socialMedia” :
{
“twitter” : “@RaduVunvulea”,
“fb” : “radu.vunvulea”
}
}
Who am I?
Agenda
• What?
• When?
• Where?
• How?
• Why?
•Static Web
• HTML & Request/Response
•Ajax
• jQuery & Prototype
•Real Time Web
• Real Time Libraries & Web Socket
Real Time Interaction
• Chat
• Notifications
• Weather
• Stock market
• Auction
• Games
• Monitoring
• Dashboard
• Document editing
• WebSocket
• Forever Frame
• Server Sent Events
• Pooling
• SPDY
What we can use?
What we can use?
• Commet
• Pusher
• SockJS
• SocketIO
• Faye
• Now.js
• Sse
• Django-sse
• Cramp
What we can use?
• Commet
• Pusher
• SockJS
• SocketIO
• Faye
• Now.js
• Sse
• Django-sse
• Cramp
SignalR
What is SignalR?
• Async library for .NET to help build real-time,
multiuser interactive web applications
• Bidirectional communication
• Open Source
• Adopted by Microsoft
• GitHub
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
Connection methods
• WebSocket
• Server Side Events
• Forever Frame
• Ajax long pooling
Persistent Connection
• Similar with WebSocket
• Persistent
• Events
• Connect
• Disconnect
• Receive
• Error
• Methods
• Send
• Broadcast
Hubs
• Over Connections
• Share variables
• Calls between client and server
• Serialization
• Capture connect/disconnect
• Everything works by magic
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#)
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
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
CSRF and SignalR
• Disable cross domain requests
• Verify connection token
• Put connection token query string
• The connection token is not persisted on the client
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
SignalR Farm
• Backplanes:
• Windows Azure Service Bus
• Redis
• SQLServer
•  Server broadcast
•  High-frequency realtime
•  Client to client
Conclusion
• SignalR
• Client to Server
• Server to Client
• Broadcasting
• Real Time application
• Scalable
• Low latency
Question
Answers
THE END
Radu Vunvulea
vunvulear@gmail.com
http://vunvulearadu.blogspot.com

Real-time Communication using SignalR and cloud

  • 1.
    Real-time fluent communication using SignalRand Cloud Radu Vunvulea vunvulear@gmail.com http://vunvulearadu.blogspot.com
  • 2.
    { “name” : “RaduVunvulea, “company” : “iQuest”, “userType” : “enthusiastic” “technologies” : [ “.NET”, “JS”, “Azure”, “Web”, “Mobile”, “SL” ], “blog” : “vunvulearadu.blogspot.com”, “email” : ”vunvulear@gmail.com”, “socialMedia” : { “twitter” : “@RaduVunvulea”, “fb” : “radu.vunvulea” } } Who am I?
  • 3.
    Agenda • What? • When? •Where? • How? • Why?
  • 7.
    •Static Web • HTML& Request/Response •Ajax • jQuery & Prototype •Real Time Web • Real Time Libraries & Web Socket
  • 8.
    Real Time Interaction •Chat • Notifications • Weather • Stock market • Auction • Games • Monitoring • Dashboard • Document editing
  • 9.
    • WebSocket • ForeverFrame • Server Sent Events • Pooling • SPDY What we can use?
  • 10.
    What we canuse? • Commet • Pusher • SockJS • SocketIO • Faye • Now.js • Sse • Django-sse • Cramp
  • 11.
    What we canuse? • 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 canuse it? • Server • Windows (.NET) • Mono • Clients • Chrome • Firefox • Safari • IE • Opera • Android browser • IoS • Windows Desktop • Silverlight • Windows Store • Windows Phone • and old browsers
  • 14.
    Connection methods • WebSocket •Server Side Events • Forever Frame • Ajax long pooling
  • 15.
    Persistent Connection • Similarwith WebSocket • Persistent • Events • Connect • Disconnect • Receive • Error • Methods • Send • Broadcast
  • 16.
    Hubs • Over Connections •Share variables • Calls between client and server • Serialization • Capture connect/disconnect • Everything works by magic
  • 17.
    Hubs • When youhave 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#)
  • 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 onConnection 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
  • 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
  • 28.
    SignalR Farm • Backplanes: •Windows Azure Service Bus • Redis • SQLServer •  Server broadcast •  High-frequency realtime •  Client to client
  • 30.
    Conclusion • SignalR • Clientto Server • Server to Client • Broadcasting • Real Time application • Scalable • Low latency
  • 31.
  • 32.