PlayerToSpectatorRequest

Turns the current user from player to spectator in a Game Room.


If the operation is successful, all the Users in the target Room are notified through the SFSEvent.PLAYER_TO_SPECTATOR event. The operation may fail if no Spectator slots are available in the target Game Room at the time of the request; in this case the SFSEvent.PLAYER_TO_SPECTATOR_ERROR event is dispatched to the requester client.

Constructor

new PlayerToSpectatorRequest(targetRoomopt)

Creates a new instance of the PlayerToSpectatorRequest class.
Pass the instance to the SmartFox#send method to validate and execute the request.
Parameters:
NameTypeAttributesDefaultDescription
targetRoomSFSRoom<optional>
nullThe object representing the Room in which the Player should be turned to Spectator; if null, the last Room joined by the User is used.