Introduction to SignalR

17,031 views
16,701 views

Published on

A modified version of my Desert Code Camp 2011.2 presentation on SignalR from November 5th, 2011.

It's modified since I'm more of a talker and rarely utilize bullet points and much text in my slides.

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

No Downloads
Views
Total views
17,031
On SlideShare
0
From Embeds
0
Number of Embeds
197
Actions
Shares
0
Downloads
0
Comments
0
Likes
17
Embeds 0
No embeds

No notes for slide

Introduction to SignalR

  1. 1. Adam Mokan @adammokanDesert Code Camp Nov 5th, 2011
  2. 2. What is SignalR?• Creates a “persistent connection” between server and client(s) in ASP.NET allowing you to push data from server to client.• Led by David Fowler and Damian Edwards.• Not an official Microsoft project.• OSS project on Github with MIT License.• NuGet packages available.• Simple to setup & just works. Install-Package SignalR
  3. 3. Potential use-cases • Chat - Don’t be that developer * • Real-time impact analysis on current users • Pub-sub mechanism for analytics, logging, exception capture • Real-time charting without repeat client-side ajax polling • Collaborative applications allowing multiple users to interact with the same screen • Real-time analytics dashboard showing client details (geo-location based on IP address, browser info, screen resolution, etc) • “Growl-like” notifications for users* No offense towards someone that has the real need to build a chat application from scratch but this reminds me of the “Learn Rails and build a blog” tutorials years ago.
  4. 4. Samples
  5. 5. SignalR.Server• Two primary approaches to implementing • Persistent Connections (low-level) • Implements an IHttpHandler • Must implement a route to make the endpoint accessible. • public class TestEndpoint : PersistentConnection { // do something } • Hubs (high-level) • Automatically implements route over “<app>/signalr/hubs/” by convention. • public class TestHub : Hub { // do something }
  6. 6. SignalR client libraries• SignalR.Js - Javascript SignalR client• SignalR.Client - .NET client for SignalR• SignalR.Client.WP7 - Windows Phone client for SignalR
  7. 7. Wait, I thought WebSockets were meant for this?This all works over HTTP?
  8. 8. Let’s look at how we interact with the webin a vast majority of scenarios and how some HTTP cleverness allows SignalR to work.
  9. 9. The basic Request-Response pattern
  10. 10. A simple example of polling via AJAX.
  11. 11. http://www.flickr.com/photos/londonmatt/4204313724/What is long-polling?
  12. 12. Let’s look at some code.
  13. 13. Resources Bitly bundle * - bit.ly/signalr-dcc11SignalR git repo - github.com/SignalR/SignalRSignalR docs - github.com/SignalR/SignalR/wiki * More resources will be added to the bitly bundle in the future
  14. 14. Thank you!Please review the presentation with any feedback or criticisms at speakerrate.com/talks/8878

×