Join a room.


- newRoom (Object)
- the name (string) or the id (int) of the room to join.
- pword (String)
- the room's password, if it's a private room (optional).
- isSpectator (Boolean)
- a boolean flag indicating wheter you join as a spectator or not (optional).
- dontLeave (Boolean)
- a boolean flag indicating if the current room must be left after successfully joining the new room (optional).
- oldRoom (Int32)
- the id of the room to leave (optional, default value: activeRoomId).

NOTE:
the last two optional parameters enable the advanced multi-room join feature of SmartFoxServer, which allows a user to join two or more rooms at the same time. If this feature is not required, the parameters can be omitted.
Sends:
SFSEvent..::.OnJoinRoomDelegate
SFSEvent..::.OnJoinRoomErrorDelegate
Version:
SmartFoxServer Basic / Pro

In the following example the user requests to join a room with id = 10; by default SmartFoxServer will disconnect him from the previous room.
CopyC#
In the following example the user requests to join a room with id = 12 and password = "mypassword"; by default SmartFoxServer will disconnect him from the previous room.
CopyC#
In the following example the user requests to join the room with id = 15 and passes true to the dontLeave flag; this will join the user in the new room while keeping him in the old room as well.
CopyC#

smartFox.JoinRoom(10);
In the following example the user requests to join a room with id = 12 and password = "mypassword"; by default SmartFoxServer will disconnect him from the previous room.

smartFox.JoinRoom(12, "mypassword");
In the following example the user requests to join the room with id = 15 and passes true to the dontLeave flag; this will join the user in the new room while keeping him in the old room as well.

smartFox.JoinRoom(15, "", false, true);