joinRoom -> leave='1'

You think you've found a bug? Please report it here.

Moderators: Lapo, Bax

Post Reply
BenSmeets
Posts: 14
Joined: 28 Mar 2006, 10:45

joinRoom -> leave='1'

Post by BenSmeets »

I think i found a possible bug.

- AS2 Client code.
- Connect();
- login, joinRoom, etc.

When i now use client.disconnect() and after that use the same login procedure again, i see in the debugger that i get logged in, and at the same time get logged out of the room again. The difference in send xml code is that the second time around i have an leave='1' instead of leave='0' in the


Code: Select all

<msg t='sys'><body action='joinRoom' r='-1'><room id='1' pwd='undefined' spec='0' leave='1' old='-1' /></body></msg>
xml
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Thanks,
it's probably a bug, I will check the API soon.

There's a simple workaround for this: after you've disconnected you should create a new instance of the SmartFoxClient object.

This is important because this way you will clear all the data of the previous session.
More in general it is good practice to do so if you call the disconnect() method , or if you got disconnected.

Hope it helps

:)
Lapo
--
gotoAndPlay()
...addicted to flash games
BenSmeets
Posts: 14
Joined: 28 Mar 2006, 10:45

Post by BenSmeets »

Jup, that's the workaround i use now. But personally i think disconnect should clear all? Saves the recreation of the object (possibly) many times. Perhaps a seperate "clear" function?

Moght save memory overhead and at least the re-adding of eventlisteners and stuff after each re-create.

Cheers,

Ben
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Thanks for the suggestion, we'll probably include a "cleaning system" in the disconnect() method
Moght save memory overhead and at least the re-adding of eventlisteners and stuff after each re-create.
Actually I don't see many problems with the memory overhead unless the application re-creates the server instance dozens of times.

Also clearing the internal structures (objects and arrays) will result in some garbage collection, very similarly to to re-creating the entire API object (unless we use a object-pooling technique, which would become too complex for this task)
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply