Page 1 of 1

Multiple SFSEvent callbacks

Posted: 17 Jul 2017, 12:27
by Dairladada
Hello,

We are trying to update our game Eredan Arena to Unity3d from Adobe Air without changing our server but we get Multiple SFSEvents callbacks even after having logged out.

We use this:

Server Version: 1.6.8
Unity Client Version: 1.2.6

Platform: Unity

Function called:
Logout()
Disconnect()
Dispose()
(at the same time, and timed, this returns the same problem)

ProcessEventQueue() is called on FixedUpdate() and runInQueueMode is true

The problem is:
When you disconnect to the smartfox (with functions above), SFSEvent callbacks is called multiple times, increasing for each new connection.

When we remove manually the events callbacks, it stack to memory too ...

The connection work, messages too, but it stacks infinitely until a crash ...

Some times, the messages receiving just stop, without sending disconnection or anything else....
And without timeout too.

Do you have any solution?
Thank you for your help.

FM.

Re: Multiple SFSEvent callbacks

Posted: 17 Jul 2017, 13:24
by Lapo
Dairladada wrote:The problem is:
When you disconnect to the smartfox (with functions above), SFSEvent callbacks is called multiple times, increasing for each new connection.

To disconnect you just need to call Disconnect(). There's no need to invoke 3 methods.
Also I am not sure I follo the "increasing for each new connection" part. Once you have disconnected you should not reuse the current SmartFox object, instead you should release the previous listeners and create a new one (thus dereferencing the former obj.)

When we remove manually the events callbacks, it stack to memory too ...

I am not sure I understand what you mean by that. Can you give me an example?

In any case make sure to recreate the SFS object before you start a new connection.

Thanks