QuickJoinOrCreateRoomRequest

Quickly joins the client in a public Room, or creates a new Room if none is found.


SmartFoxServer searches for a public Room that meets the criteria expressed by the passed matching expression in the passed Room Group/s. If no suitable Room is found, a new Room is created, based on the passed settings.

If a Room is created, the SFSEvent.ROOM_ADD event is dispatched to all the Users which subscribed the Group to which the Room belongs, including the Room creator. In any case, whether a Room to join is found or created, the SFSEvent.ROOM_JOIN event is then dispatched. Error conditions (Room creation error, Room join error) should always be checked adding the appropriate event listeners.

Constructor

new QuickJoinOrCreateRoomRequest(matchExpression, groupList, settings, roomToLeaveopt)

Creates a new instance of the QuickJoinOrCreateRoomRequest class.
Pass the instance to the SmartFox#send method to validate and execute the request.
Parameters:
NameTypeAttributesDefaultDescription
matchExpressionMatchExpressionA matching expression to use to look for a Room where to join the User.
groupListArray.<string>A list of Group names to further filter the search; if null, all Groups are searched.
settingsRoomSettingsAn object with the configuration parameters to create a new Room, in case an existing Room can't be found through the matching expression.
roomToLeaveSFSRoom<optional>
nullAn object representing a previously joined Room that the User should leave when joining the new Room.