Page 1 of 1

Connection lost after idle

Posted: 27 Nov 2014, 09:43
by Elzean
Hi,

i'm trying to detect the connection lost on the client side because of being idle for too long. I logged into my app fine ten wait around 15s (i set it up short for testing) and the server disconnect me as expected. On the client i never get the CONNECTION_LOST event fired, should i listen to another one ?

Thanks!

Re: Connection lost after idle

Posted: 27 Nov 2014, 15:09
by Lapo
The event should be absolutely be fired.
Can you give me more details? API version, server version, testing platform...
Are you testing locally?

Re: Connection lost after idle

Posted: 27 Nov 2014, 18:50
by Elzean
Right now im testing locally with the 2.9.0 version

i do something like this first :

Code: Select all

smartFox.AddEventListener(SFSEvent.CONNECTION, OnConnection);
smartFox.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
smartFox.AddLogListener(LogLevel.DEBUG, OnDebugMessage);

smartFox.Connect(serverName, serverPort);
then :

Code: Select all

public void OnConnectionLost(BaseEvent evt)
{

        string error = (string)evt.Params["error"];
        Debug.Log("OnConnectionLost !!!! " + " (error : <" + error + ">)");

	UnregisterSFSSceneCallbacks();
	LostConnection();
	}
but the OnConnectionLost never get called.

But it seems to happen online too, the program should send the user back to the login page when OnConnectionLost is called but when i idle too long on the online app i just get stuck with an unresponsive app (same behavior as when i test locally and idle)

Re: Connection lost after idle

Posted: 27 Nov 2014, 20:18
by Elzean
Found out the problem, i had a "SFSManagerController.smartFox.RemoveAllEventListeners();" hiding somewhere... So it seems fine now thx !