SignalR for ASP.NET Developers

5,442 views
5,281 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,442
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
132
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

SignalR for ASP.NET Developers

  1. 1. ASP.NETSignalR
  2. 2. Topics Focused On!!!• Traditional Web Approach• What does “Real Time” mean?• SignalR – “The Rockstar”• Quick Glance at - Transport Techniques• Types of Connections• How do I get SignalR?• Demo
  3. 3. Traditional Web Approach Sends a Request to the Server – (Step 1) [In other words, the Client is trying to pull some information from the Server] SERVERCLIENT Response Sent back to the Client – (Step 3) Processes the Request (Step 2)
  4. 4. Real Time Web Applications
  5. 5. What is Real Time Web Application?• In simple terms, “Real Time” means an immediate response being sent by the Server to the Client.• Real Time is all about “Pushing” instead of “Pulling”• Push Technology is completely different from Pull Technology. Its about getting told what’s new, instead of asking for what’s new!!!• Facebook, Twitter, Yahoo Cricket Live, Stock Ticker
  6. 6. Real Time Web Approach User Sends a Request to the ServerCLIENT Creates a Persistent Connection between them SERVER Response Sent back to the Client Response Sent back to the Client Response Sent back to the Client
  7. 7. SignalR – The Rockstar• SignalR is an asynchronous library. Used to develop Real Time Web Application.• Concept intiated by “David Fowler” and “Damien Edwards”• Provides Client to Server persistent connection over HTTP.• Makes use of Push Technology.• Provides Abstraction over the set of transports.• Open Source available on Github!!!
  8. 8. SignalR Transport ConnectionsTechniques
  9. 9. Transport Priority WebSockets Server-Sent events Forever Frame (IE hack) Long Polling
  10. 10. WebSocket• A new transport technique which came up with HTML5.• It internally works on top of TCP protocol. Pros Cons Full-duplex persistent Supported only on latest connection (both ways) browsers – (IE 10) Fastest solution Works only with IIS-8.0
  11. 11. Server Sent Events• Requires a single connection between Client-Server.• Uses Javascript API – “EventSource” through which Client can request a particular URL to receive data stream.• Used to send Message Notifications or Continuous Data Streams. Pros Cons No need to reconnect Works in server-to-client direction only Not supported in IE
  12. 12. Forever Frames• Data is sent out in chunks.• Internally creates an Iframe along with a script on the page to fetch the data. Pros Cons Supported on IE Browser. Iframes are loaded again and again with chunks of data. All script tags remain on the page
  13. 13. Long Polling Server ResponseRequest Variable delay Client Time: requests event ‘n’ seconds (variable)
  14. 14. SignalR Connections HubsPersistent Connection
  15. 15. Persistent Connection• Provides a raw / low-level control to manage connection.• Contain events like “OnConnection”, “OnDisconnection”, “OnReconnection”• We can write our own logic in these events.
  16. 16. Hubs• Provides a High-level API.• Client calling Server.• Server calling Clients. (All, Groups, One).• Broadcasting messages to all connected clients.• Works in a similar way like a “Controller”
  17. 17. How do I get SignalR?
  18. 18. Some References!!!Some JQuery!!!
  19. 19. Routing is Very Important!!!
  20. 20. Server Calling Client
  21. 21. Client Calling Server Function
  22. 22. DEMO
  23. 23. Thanks for Listening!!!

×