real-time communication using signalr and cloud
DESCRIPTION
This session will explore how SignalR can make our life easier to create real-time application that works on any kind of device or browser.TRANSCRIPT
![Page 1: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/1.jpg)
Real-time fluent communication using
SignalR and Cloud
Radu Vunvulea
http://vunvulearadu.blogspot.com
![Page 2: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/2.jpg)
{“name” : “Radu Vunvulea,“company” : “iQuest”,“userType” : “enthusiastic”“technologies” : [ “.NET”, “JS”, “Azure”, “Web”, “Mobile”, “SL” ],“blog” : “vunvulearadu.blogspot.com”,“email” : ”[email protected]”,“socialMedia” :
{“twitter” : “@RaduVunvulea”,
“fb” : “radu.vunvulea”}
}
Who am I?
![Page 3: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/3.jpg)
Agenda
• What?• When?• Where?• How?• Why?
![Page 4: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/4.jpg)
![Page 5: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/5.jpg)
![Page 6: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/6.jpg)
![Page 7: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/7.jpg)
• Static Web• HTML & Request/Response
•Ajax• jQuery & Prototype
•Real Time Web• Real Time Libraries & Web Socket
![Page 8: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/8.jpg)
Real Time Interaction
• Chat• Notifications• Weather• Stock market• Auction• Games• Monitoring• Dashboard• Document editing
![Page 9: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/9.jpg)
• WebSocket• Forever Frame• Server Sent Events• Pooling• SPDY
What we can use?
![Page 10: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/10.jpg)
What we can use? • Commet• Pusher• SockJS• SocketIO• Faye• Now.js• Sse• Django-sse• Cramp
![Page 11: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/11.jpg)
What we can use? • Commet• Pusher• SockJS• SocketIO• Faye• Now.js• Sse• Django-sse• Cramp
SignalR
![Page 12: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/12.jpg)
What is SignalR?
• Async library for .NET to help build real-time, multiuser interactive web applications• Bidirectional communication• Open Source• Adopted by Microsoft • GitHub
![Page 13: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/13.jpg)
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
![Page 14: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/14.jpg)
Connection methods
• WebSocket• Server Side Events• Forever Frame• Ajax long pooling
![Page 15: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/15.jpg)
Persistent Connection
• Similar with WebSocket• Persistent• Events• Connect• Disconnect• Receive• Error
• Methods• Send• Broadcast
![Page 16: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/16.jpg)
Hubs
• Over Connections• Share variables• Calls between client and server• Serialization• Capture connect/disconnect
• Everything works by magic
![Page 17: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/17.jpg)
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#)
![Page 18: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/18.jpg)
![Page 19: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/19.jpg)
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
![Page 20: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/20.jpg)
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
![Page 21: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/21.jpg)
![Page 22: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/22.jpg)
![Page 23: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/23.jpg)
CSRF and SignalR
• Disable cross domain requests• Verify connection token• Put connection token query string• The connection token is not persisted on the client
![Page 24: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/24.jpg)
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
![Page 25: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/25.jpg)
![Page 26: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/26.jpg)
![Page 27: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/27.jpg)
![Page 28: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/28.jpg)
SignalR Farm
• Backplanes:• Windows Azure Service Bus• Redis• SQLServer
• Server broadcast• High-frequency realtime• Client to client
![Page 29: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/29.jpg)
![Page 30: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/30.jpg)
Conclusion
• SignalR• Client to Server• Server to Client• Broadcasting• Real Time application• Scalable• Low latency
![Page 31: Real-time Communication using SignalR and cloud](https://reader033.vdocuments.us/reader033/viewer/2022061220/54bad2ee4a7959f6428b4593/html5/thumbnails/31.jpg)
Question
Answers