Page 1 of 1

How to detect client connection from server

Posted: 22 Jun 2011, 10:06
by zkidkid
Hi All,

Currently, I catch the message ( userLost, userExit, ..) from server to check whether user connection lost but It didn't work as I wish.

example, when the user unplug the network cable, I want the server could detect its event and fire it through handleInternalEvent ( or something like that) (like the way player.io do).

I just want someone who could confirm me whether I could do it. or I should send a message frequently ( eg. a message for every 10s).

Thanks.

Posted: 22 Jun 2011, 23:22
by BigFIsh
This is detected by 'UserLost' internal event.

However, when an abrupt disconnection had occurred (such as unplugging the network cable or closing down the browser), it can take time for the server to detect this as it depends on the client. It is known to be more common with IE.

Shortening the MaxUserIdleTime can reduce the delay of detecting connection lost - but would mean you'll have to send a empty message to the server more often to avoid disconnection.

This have been discussed quite a bit before, so I'd recommend using the Search tool to find some further information about this.

Posted: 23 Jun 2011, 15:08
by zkidkid
Hi,

It take so much time to detect UserLost event in Internal Event.

I just make a test, if I close a tab in browser then I wait a long time to receive that event, but if I close all tab in browser then It fire the event immediatly.

Could you explain me what happen ?

Thanks so much BigFIsh

Posted: 23 Jun 2011, 23:16
by BigFIsh
I afraid you'd have blame the browser for this behavior. In other words, there's not much SFS can do about this.

Just out of curiously, what was the browser you used? Also have you tried other browsers?

Posted: 24 Jun 2011, 04:48
by zkidkid
Hi,
You could test it in IE9
It fire the userlost event immediately if you close all tab.