PublicMessageRequest

Sends a public chat message.


A public message is dispatched to all Users in the specified Room, including the message sender (this allows showing messages in the correct order in the application interface); the corresponding event is the SFSEvent.PUBLIC_MESSAGE event. It is also possible to send an optional object together with the message to transmit additional data.

Note that the SFSEvent.PUBLIC_MESSAGE event is dispatched if the Room is configured to allow public messaging only (see the RoomSettings#permissions parameter).

Constructor

new PublicMessageRequest(message, parametersopt, targetRoomopt)

Creates a new instance of the PublicMessageRequest class.
Pass the instance to the SmartFox#send method to validate and execute the request.
Parameters:
NameTypeAttributesDefaultDescription
messagestringThe message to be sent to all the Users in the target Room.
parametersSFSObject<optional>
nullAn object containing additional custom parameters to be sent to the message recipients .
targetRoomSFSRoom<optional>
nullThe object representing the Room where the message should be dispatched; if null, the last Room joined by the User is used.