SignalR
Posted: Mon Jan 20, 2014 2:29 pm
Finally got time to test SignalR. For those which do not know what it is, let's first try to resume quickly what a websocket is:
WebSockets are basically a way to keep a connection between the server and the browser open all the time and allow bi-directional communication, which means the server can continue to send data to the browser and the browser to the server at any time without needing to check every now and then like you usually do with Ajax.
So far the best option to use web sockets is socket.io and node.js. Sure it's dead simple to implement, but yet I'm far from being a fan of node.js (and javascript in general).
On the other side I love .NET. SignalR is basically the response to socket.io offered to the .NET community. It let you build up real time 2 directional web application while still working with C# or Vb.NET for example.
The trick to make it work, is that you need to work with .NET 4.5 or 4.5.1 and if you don't have VS 2013, install the SignalR packages (in VS 2013 it's there for you already).
As simple example:
http://www.asp.net/signalr/overview/sig ... signalr-20
I had 1 issue, my hub class wasn't visible from my JS code as it makes the first character lowercase even if you write it upper case in .NET, beside that issue, I managed to make it work, and I can tell you, it opens the door to many web apps I have in mind here at work.
WebSockets are basically a way to keep a connection between the server and the browser open all the time and allow bi-directional communication, which means the server can continue to send data to the browser and the browser to the server at any time without needing to check every now and then like you usually do with Ajax.
So far the best option to use web sockets is socket.io and node.js. Sure it's dead simple to implement, but yet I'm far from being a fan of node.js (and javascript in general).
On the other side I love .NET. SignalR is basically the response to socket.io offered to the .NET community. It let you build up real time 2 directional web application while still working with C# or Vb.NET for example.
The trick to make it work, is that you need to work with .NET 4.5 or 4.5.1 and if you don't have VS 2013, install the SignalR packages (in VS 2013 it's there for you already).
As simple example:
http://www.asp.net/signalr/overview/sig ... signalr-20
I had 1 issue, my hub class wasn't visible from my JS code as it makes the first character lowercase even if you write it upper case in .NET, beside that issue, I managed to make it work, and I can tell you, it opens the door to many web apps I have in mind here at work.