You may be a bit confused with this post’s title - does it even make any sense to talk about real-time in the web? Before we answer that - what makes a real-time application? That’s quite easy - event source pushes the events towards user’s dashboard (in this case - the web browser). Doesn’t sound really “webbish”, does it? It pretty much means we should poll the web server for the events raised since last poll - it’s not very real-time and it means that magnitudes of flashing, ultra-short connections are being created and closed every second (for all the users working with the dashboard).

What if we could get rid of the polling? What if it’s possible to keep the connection and make server pull the data toward client browsers? Sounds s-f? We’re not even there yet :) Let’s assume we could push events towards a web page - what would “catch” those events? The only reasonable option is a javascript method, but it pretty much means that .NET method on the web server would have TO CALL a JavaScript method on the client side. Truly, it doesn’t look feasible, but … It’s possible, mainly to ‘dynamic’ keyword introduced in .NET 4.0 :)
The answer to our problems is named SignalR and it can be found here: http://signalr.net/
After playing a bit with this, I may say that it’s quite interesting, especially if you’re about to create something like a chat application or maybe a stock ticker.
Share this post