Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public class StatusHub : Hub {
  2. public override Task OnDisconnected()
  3. {
  4. //handles the disconnected event as needed
  5. return base.OnDisconnected();
  6. }
  7.  
  8.  
  9. public override Task OnConnected()
  10. {
  11. //handles the connected event as needed
  12. return base.OnConnected();
  13. }
  14. }
  15.  
  16. public class ChatHub : Hub {
  17. public override Task OnDisconnected()
  18. {
  19. //should handle the chat disconnected event but is never reached
  20. return base.OnDisconnected();
  21. }
  22.  
  23.  
  24. public override Task OnConnected()
  25. {
  26. //should handle the chat connected event but is never reached
  27. return base.OnConnected();
  28. }
  29. }
  30.  
  31. $.connection.hub.start().done(function() {
  32. //a lot of code here (irrelevant to the question I think)
  33. });
  34.  
  35. $(function()
  36. {
  37. // A no-op client method so the hub's
  38. // OnConnected, OnReconnected and OnDisconnected method overloads are triggered.
  39. $.connection.chatHub.noop = function () { };
  40. $.connection.hub.start()
  41. .done(function() { console.log("SignalR connection is up and running."); })
  42. .fail(function(error) { console.log(error); });
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement