SignalR Runtime Issues with Earlier version of .NET Framework

SignalR Runtime Issues with Earlier version of .NET Framework

SignalR is used for real time data transfer or real time messaging in .NET framework. The architecture behind this is, there will be a server application which will host the SignalR Hub. On the other hand the client application will incorporate some client scripting using JQuery to connect the SignalR hub by creating the hub proxy. They work bi directionally. Either the server can call the client method or the client can call the server method.

On page loading the client will initially connect with the server and can pass few data to the server through method parameter. In order to achieve this it is important to make sure the hub is ready before making any request to the server. To implement this the following code will work fine because this is synchronous approach. Assuming that the hub name is "dataSyncHub" and in the hub there is a method called connect(string param).

No alt text provided for this image

So far everything works fine with the latest version of .NET framework e.g. .NET 3.5 or .NET 4.5. but when it comes to older or legacy application most of the time it confuses the developer to detect the actual error. The system sometimes give null reference exception at the method $.connection.hub.start() , sometimes enter into the function but not other times. And in many cases it does not tell the actual reason for this malfunction. The actual reason for this is the earlier version of .NET may not support properly the Web Socket on which signalR is built.

In order to solve this problem just little effort need to given. That is to add a line of code in web.xml.

No alt text provided for this image

Hope this will work for those who are dealing with legacy application.

 

To view or add a comment, sign in

More articles by Abu Hena Mostafa Kamal

Explore content categories