Last post Sep 03, 2014 01:41 AM by Kevin Shen - MSFT
Sep 02, 2014 08:20 AM|852EC327|LINK
A project will have several hubs, and each of them will have its own OnDisConnected method. So when the website is closed, which hub(s)'s OnDisConnected will be raised? Is there anything special?
Can the Context.ConnectionId be shared between several different kinds of Hubs? I mean suppose if I save a ConnectionId into some place, and then I call:
I mean: Can I use HubB's connectionId to raise the client event in the HubA?
//This is in HubB method.
IHub iHub = GlobalHost.ConnectionManager.GetHubContext<HubA>();
Hub will be automatically created and saved (managed) in the GlobalHost.ConnectionManager as a container, is that right?
Sep 03, 2014 01:41 AM|Kevin Shen - MSFT|LINK
For your first issue, you can refer to the phase which is given in link below:
with multiple connection IDs if you connect from multiple browser windows or tabs.
When the user closes a browser window or tab, or navigates to a new page or refreshes the page, the SignalR connection immediately ends because SignalR client code handles that browser event for you and calls the Stop method. In these scenarios, or in any
For your second issue, you can send message or call method outside of Hub A class in your Hub B class:
You can refer to the link below :
For your third issue ,I am not quite sure if the hub is created and saved in the GobalHost.ConnectionManager..
But according to explanation of the Hub object lifetime in the link bleow:
You don't instantiate the Hub class or call its methods from your own code on the server; all that is done for you by the SignalR Hubs pipeline.
SignalR creates a new instance of your Hub class each time it needs to handle a Hub operation such as when a client connects, disconnects, or makes a method call to the server.