SignalR - Handling disconnected users

Posted by guilhermeGeek on Stack Overflow See other posts from Stack Overflow or by guilhermeGeek
Published on 2012-09-02T08:35:26Z Indexed on 2012/09/02 9:38 UTC
Read the original article Hit count: 336

Filed under:

Hy,

I'm using the signalR library on a project to handle an notification and chat modules. I've a table on an database to keep a track of online users.

The HUB for chat is inheriting IDisconnect where i disconnect the user. After disconnecting the user, i warm the users about that event. At this point, i check if the disconnect user is the client. If it's, then i call an method on HUB to reconnect the user (just update the table).

I do this because with the current implementation, once the user closes a tab on the browser it calls the Disconnect task but he could have another tab opened.

I've not tested (with larger requests) this module yet, but on my development server it could take a few seconds between the IDisconnect event, and the request from the user to connect again.

I'm concerned with my implementation to handle disconnected users from the chat but i can't see another way to improve this.

If possible, could someone give me a advice on this, or this is the only solution that i've?

© Stack Overflow or respective owner

Related posts about signalr