_server.leaveRoom cause of Client API error

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
Kleon
Posts: 37
Joined: 19 Mar 2010, 07:03

_server.leaveRoom cause of Client API error

Post by Kleon »

Hello,

I need to create a room and join users to it without update sending to other clients.

For this goal I do following:

//sendUpdate property = false

Code: Select all

_server.createRoom(roomObj, null, false, false);
then I call "joinRoom":

//sendUpdate property = false

Code: Select all

_server.joinRoom(user1, -1, false, newRoom.getId(), null, false, false);
_server.joinRoom(user2, -1, false, newRoom.getId(), null, false, false);
But however when I call "_server.leaveRoom" function

//broadcastAll = false

Code: Select all

_server.leaveRoom(user2, roomID, false);
I get an error in the "handleUserLeaveRoom" method (SysHandler class of Smartfox client API).
I don't need to send notifications(join/create/leave room) to other clients. But How I can disconnect users from the room without the error on the client side?
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

When the room was created, did the clients received that new room prior to joining and leaving it? (It is required)
Smartfox's forum is my daily newspaper.
Kleon
Posts: 37
Joined: 19 Mar 2010, 07:03

Post by Kleon »

BigFIsh wrote:When the room was created, did the clients received that new room prior to joining and leaving it? (It is required)
No. I just join the clients to the room in my extension. What should I do to notify clients API about it?
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

_server.createRoom(roomObj, user, sendUpdate, broadcastEvt, roomVars, varsOwner, setOwnership)

you need to specify true for sendUpdate - then the clients will receive the newly created room.
Smartfox's forum is my daily newspaper.
Kleon
Posts: 37
Joined: 19 Mar 2010, 07:03

Post by Kleon »

BigFIsh wrote:_server.createRoom(roomObj, user, sendUpdate, broadcastEvt, roomVars, varsOwner, setOwnership)

you need to specify true for sendUpdate - then the clients will receive the newly created room.
As far I understand if I specify true for sendUpdate, then all clients will recieve notifications about it. So I set this property to false specially.

Is there any way to specify true for sendUpdate and avoid error on client side?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

I need to create a room and join users to it without update sending to other clients.
This is not good practice in SFS 1.x
Without the client knowing about the Rooms you will end up with out-of-synch clients.

Make sure to download the latest version 1.6.9 and use the latest API provided. I can't guarantee it will work, but if you aren't using those please try.
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply