JoinRoomInvitationRequest

Sends an Invitation to other Users/Players to join a specific Room.


Invited Users receive the Invitation through the SFSEvent.INVITATION event, dispatched to the client: they can accept or refuse it by means of the InvitationReplyRequest, which must be sent before the Invitation expires.

Depending on the Room settings, the Invitation can be sent by the Room owner only or by any other User. This behavior can be set via the RoomSettings#allowOwnerOnlyInvitation parameter. Note that Spectators in a Game Room are not allowed to invite other Users; only Players are.

An Invitation can also indicate the amount of time available to invitees to reply. A positive answer triggers the attempt to join the User in the target Room. For Game Rooms, the asSpectator flag passed to the constructor can be set to join the invitee as Spectator instead of Player.

If the Invitation is accepted, the User automatically joins the Room and no other notification is sent to the inviter other than the normal SFSEvent.USER_ENTER_ROOM event. If instead the Invitation is refused or expires, an SFSEvent.INVITATION_REPLY event is dispatched to the inviter, with the appropriate InvitationReply identifier.

Constructor

new JoinRoomInvitationRequest(targetRoom, invitedUserNames, parametersopt, expirySecondsopt, asSpectatoropt)

Creates a new instance of the JoinRoomInvitationRequest class.
Pass the instance to the SmartFox#send method to validate and execute the request.
Parameters:
NameTypeAttributesDefaultDescription
targetRoomSFSRoomThe object representing the Room to join (must have free User/Player/Spectator slots).
invitedUserNamesArray.<string>A list of names of the Users to invite.
parametersSFSObject<optional>
nullAn object containing any relevant parameter or message to be sent to the invited users, for example an Invitation message.
expirySecondsnumber<optional>
30The number of seconds before the Invitation expires.
asSpectatorboolean<optional>
falseIn Game Rooms only, indicates if the invited User/s should join as Spectator/s instead of Player/s.