Connection lost after idle

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

Post Reply
Elzean
Posts: 13
Joined: 11 Jul 2014, 07:24

Connection lost after idle

Post 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!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Connection lost after idle

Post 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?
Lapo
--
gotoAndPlay()
...addicted to flash games
Elzean
Posts: 13
Joined: 11 Jul 2014, 07:24

Re: Connection lost after idle

Post 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)
Elzean
Posts: 13
Joined: 11 Jul 2014, 07:24

Re: Connection lost after idle

Post by Elzean »

Found out the problem, i had a "SFSManagerController.smartFox.RemoveAllEventListeners();" hiding somewhere... So it seems fine now thx !
Post Reply