Page 1 of 1

_server.leaveRoom cause of Client API error

Posted: 18 Oct 2010, 12:04
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?

Posted: 18 Oct 2010, 18:52
by BigFIsh
When the room was created, did the clients received that new room prior to joining and leaving it? (It is required)

Posted: 19 Oct 2010, 06:43
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?

Posted: 19 Oct 2010, 07:43
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.

Posted: 19 Oct 2010, 09:06
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?

Posted: 19 Oct 2010, 13:07
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.