Introduction to SignalR:

SignalR is an async, persistent connection/signalling library for .NET, that aids in  building real time, multi-user connected applications. It provides persistent client-server connectivity over best transport and abstracts away the transport layer for ease of development. While it started out for Web applications, SignalR has been ported to other platforms and now supports mobile clients like Windows Phone, iOS and Mono for Android.

Please visit: https://github.com/SignalR/SignalR#readme for more information on SignalR.

Where's the Gap?

What if you were a passionate Windows Phone developer and felt the need of adding real-time interactivity in your Windows Phone apps? What if you wanted to show your users on a map in their phones or on a website? How about opening up chat between your users or real-time tech help? You have heard of SignalR coolness; but have doubts about how much information you would have to soak up. May be you are not sure what your backend server needs to provide or if .NET web applications could serve as your server.

Well, that was me a few weeks back :) Since then, I have stumbled, learnt, tore off some hair or jumped up in joy trying to make a platform for Windows Phone applications to communicate seamlessly with a backend server through SignalR. With an intimate device like our smartphones & the interactivity provided by SignalR, the possibilities are endless. Here's my little pitch to save you a few hours :) 

Project Description:

SignalR Helper for Windows Phone makes it easier for WPDevs to leverage SignalR in making connected real-time Windows Phone applications. Various modes of communication between phone and server will be stubbed out .. like real-time Mapping, Chat, Stocks, Game Scores, Object Sync etc. Re-use or extend to make it work for your own needs.

Iterative feature addition planned, including a NuGet sometime. Hope this helps!

Project Demo:


Project Walk-through:

Would you listen to me rambling or just try out the project yourself? So, go ahead ... download the source code & hit F5 to see it in action. There are requisites & detailed explanations in the Documentation tab; but here's what you should roughly expect:

  • The source code makes up for two things essentially -- a Web project & a Windows Phone client application.
  • The MVC 3 web application hosts the SignalR Hubs and acts as the backend server.
  • The Windows Phone client application utilizes SignalR to connect seamlessly to the Hubs on the server to provide real-time interactivity & communication.
  • Both the Web & the Phone applications should launch on F5. You should see the Windows Phone emulator & a browser pop up running the two applications, like so ...



  • Four types of functionality is stubbed out through generic interfaces.
  • Mapping -- Watch the phone application use Location services to put real-time pushpins on a map on the server. Something like this ...



  • Chat -- This provides real-time chatrooms between the SignalR server & connected Windows Phone clients, with the extensibility of peer-2-peer chats. Something like this ...



  • Game Scores -- How about keeping track of Game Scores or building Stock Tickers on Windows Phone applications? This functionality stubs out sharing real-time Game Scores, like so ...



  • Object Sync -- How would you like to keep a complex .NET object in sync between the Windows Phone client & the server? Thanks to the JSon serialization/deserialization, this is possible & pretty easy. Here's what you'd see ...



I'll explain much more .. but go ahead & please give it a spin.

Acknowledgments:

While I did bring some of my Windows Phone developer enthusiasm to the table, nothing would be possible without trying to understand & make SignalR work. To that end, I am eternally grateful to the following folks for sharing their knowledge & selfless help through open-source code:

  • David Fowler
  • Damian Edwards
  • Scott Hanselman
  • Justin Beckwith
  • Maarten Balliauw
  • Sumit Maitra

Please offer feedback so this work may be improved. Thank you everyone & cheers!

Last edited Jun 6, 2012 at 5:50 AM by samidip, version 29