4

I have a page with 2 partial views. Each uses a (different) hub. So one uses hub1, the other hub2. This works fine as long as I do $.connection.hub.start() in both partial views. However, this results in two connections being open to the server..

If I don't do the start() call in one of the partial views I get sync issues and the exceptions that I must call start() first.

Is there some way to achieve this? Is $.connection a singleton and does it have an event i can attach to for when hubs have started?

tereško
  • 58,060
  • 25
  • 98
  • 150
XeroxDucati
  • 5,130
  • 2
  • 37
  • 66

1 Answers1

0

No it doesn't have an event. You can always call start in the layout page.

davidfowl
  • 37,120
  • 7
  • 93
  • 103
  • 2
    But what if there are timing issues? I initialize my hubs on `$(document).ready()` and there is no (easy) way for me to know when both of them are done and ready to be started. How can we determine if it has been started or not, for example? – Mikael Östberg Oct 15 '12 at 15:13
  • i have the same question: http://stackoverflow.com/questions/15066693/signalr-check-if-hub-already-started – daniel Feb 25 '13 at 13:21