I'm trying to use SignalR version 1.2.1 with Mono 2.10 (in my existing project). Basically it works great. But when coming to Connection and Disconnection, the count is never matching. I'm trying to keep track of the clients connected and update the clients accordingly. Here is my use case,
I'm having three frames loaded with three different pages. Top (used for real-time updates), Left tree(for page navigation) and right page (actual content page). The top page will remain forever and which will be constantly updating the real time values (i require to connect to the hub here). Similarly in one of the content page (say page A), i need to connect to SignalR and SignalR should constantly update some real-time information, until I'm connected in this page A. I'm thinking of starting a timer in the hub when the user navigates to this page and keep on pushing the data to the connected clients. Once the user navigates out of page A (or closes the browser), i should stop the timer. There are also chances like multiple users connected at page A, hence i should make sure that there are no clients currently in page A before stopping the timer.
To test this I'm just having a static variable to increment and decrement the counter as and when user is connected/disconnected from page A. I'm doing this in OnConnected and Ondisconnected events of the hub. The problem is, I'm always getting OnConnected event. But I'm not getting OnDisconnected event all the time. I have tried various scenarios like navigating to other page within my website, reloading same Page A again, closing the tab/window etc., But I'm facing problem most of the time in page navigation. It is not calling disconnect always and my counter never comes down to zero again. I tried setting the timeouts but that also doesnt seem to call disconnect.
Can anyone help me on this? How to detect the clients disconnection and stop the timer? Thanks in advance.
PS: I have to stick to Signal 1.2.1 due to the .NET framework 4.0 requirement. i.e., i cannot update to 4.5.