SignalR OnConnected and OnDisconnected not firing
Figured it out. I was calling the methods on the server object rather than the client:
$.connection.onlineHub.server.connected = function (id, date) { $("#results").append("connected: " + id + " : " + date + "</br>"); }; $.connection.onlineHub.server.disconnected = function (id, date) { $("#results").append(("connected: " + id + " : " + date + "</br>"); };
should be
$.connection.onlineHub.client.connected = function (id, date) { $("#results").append("connected: " + id + " : " + date + "</br>"); }; $.connection.onlineHub.client.disconnected = function (id, date) { $("#results").append(("connected: " + id + " : " + date + "</br>"); };
So it looks like if signalR hasn't got anything defined for the task within the OnDisconnected or OnConnected, then they don't get fired. Which makes sense.