Last post Oct 31, 2014 08:44 PM by Ruchira
Oct 31, 2014 11:19 AM|photomoose|LINK
Here's the scenario:
A user logs into the website and establishes a user session. The user then browses to a page using SignalR and establishes a connection to a hub using websockets. The server sends out messages periodically.
The user then opens up another tab in the browser and clicks on the "Logout" link, which kills the user session. Subsequent page views are not possible as the user has to login. The SignalR connection in the other tab, however, remains active and still continues
to receive updates from the server. Is there a way to detect when the user session has been killed?
the PingHandler doesn't require any authentication.
Does anyone have any ideas?
Oct 31, 2014 08:44 PM|Ruchira|LINK
As for now there is no direct server side implementation for stopping the connection between server and client from the client side (AFAIK). What you can do is, in the
Session_End event of the Global.asax call a client side method which will end the connection. Like below
void Session_End(object sender, EventArgs e)
IHubContext context = GlobalHost.ConnectionManager.GetHubContext<YourHubName>();
Client side implementation
Please 'Mark as Answer' if this post helps you