Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StatusHub : Hub {
- public override Task OnDisconnected()
- {
- //handles the disconnected event as needed
- return base.OnDisconnected();
- }
- public override Task OnConnected()
- {
- //handles the connected event as needed
- return base.OnConnected();
- }
- }
- public class ChatHub : Hub {
- public override Task OnDisconnected()
- {
- //should handle the chat disconnected event but is never reached
- return base.OnDisconnected();
- }
- public override Task OnConnected()
- {
- //should handle the chat connected event but is never reached
- return base.OnConnected();
- }
- }
- $.connection.hub.start().done(function() {
- //a lot of code here (irrelevant to the question I think)
- });
- $(function()
- {
- // A no-op client method so the hub's
- // OnConnected, OnReconnected and OnDisconnected method overloads are triggered.
- $.connection.chatHub.noop = function () { };
- $.connection.hub.start()
- .done(function() { console.log("SignalR connection is up and running."); })
- .fail(function(error) { console.log(error); });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement