I\'m using SignalR 1 with MVC4 C# web application with form authentication. I have a code in my layout page in JavaScript :
$(documnet).ready(function(){
One way you could do what you ask is to write a disconnect event on your client that the server can call through SignalR. Maybe something somewhat like this:
myHub.client.serverOrderedDisconnect = function (value) {
$.connection.hub.stop();
};
Then, on the server, something like this:
Clients.Client(Context.ConnectionId).serverOrderedDisconnect();