events not firing after un/re-subscribing.

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

dingo
Posts: 98
Joined: 27 Jan 2009, 21:34

events not firing after un/re-subscribing.

Postby dingo » 19 Jan 2011, 18:59

Hi there

I think I've found a possible bug in the AS3 client API

I have a group called "chicken", the user is only subscribed when he's not in a room from "chicken".

When he leaves a chicken-room, he's resubscribed to "chicken" so he can see which chicken-rooms are available.

So when he leaves a room, i do the following:

Code: Select all

sfs.send(new LeaveRoomRequest(sfs.getRoomById(activeRoomID)));
sfs.send(new SubscribeRoomGroupRequest("chicken"));


If i do it the other way around

Code: Select all

sfs.send(new SubscribeRoomGroupRequest("chicken"));
sfs.send(new LeaveRoomRequest(sfs.getRoomById(activeRoomID)));


The following problems occur:
1. the room i just left has now 0 userCount although there are still users in there
2. i do not receive any of the global events coming from the room i just left (USER_COUNT_CHANGE, ROOM_ADD) although i can see that they are being received on the client.

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

Postby Lapo » 23 Jan 2011, 16:58

One problem I see is that both Subscribe and Unsubscribe respond with a client side event that must be handled before performing other operations.
If you subscribe and perform another operation immediately after you are breaking the proper synchronization.
You should:
1- Subscribe
2- Handle the server response
3- In the above handler perform the next operation (leave, join... whatever)
Lapo
--
gotoAndPlay()
...addicted to flash games
dingo
Posts: 98
Joined: 27 Jan 2009, 21:34

Postby dingo » 24 Jan 2011, 09:53

True, I didn't think of that.
I'm doing it the other way around now anyway.

Thanks

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: No registered users and 11 guests