What I Read Yesterday–SignalR

When WebSockets make their debug for .NET (Windows 8 and .NET 4.5), you will be able to persist a channel between the browser and the webserver, and the webserver will be able to feed the page live updates, etc.

In the meantime, if you want to update the page, the out-of-the-box way to do it is through polling. In DevDash, the status page checks the server every several seconds for the latest node statuses.

SignalR provides a better way to do this (as do other products that the SignalR links refer to). It achieves live updates by LONG POLLING. The page basically makes a request for a resource on the web server, and that resource blocks until there is something to respond with. As soon as there is something to respond with, the page receives the data and can update automatically.

On the server, you can indicate which javascript method to call on the page.

I don’t have any hands on experience with this, but it reads great. There are several places in DevDash where I can use this.

It works in other client scenarios too, although the Javascript client is the one I’m most interested in at the moment.

It also has built in support for WebSockets if the browser and server supports it. That will allow you to use the same SignalR api via the websocket rather than via long polling.

https://github.com/SignalR

http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: