|
SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
|
Sends a public chat message. More...
#include <PublicMessageRequest.h>
Public Member Functions | |
| PublicMessageRequest (std::string message, const entities::SFSObject *params=nullptr, std::shared_ptr< entities::Room > targetRoom=nullptr) | |
| Creates a new PublicMessageRequest. | |
Sends a public chat message.
A public message is dispatched to all the 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 event::SFSEvent::PUBLIC_MESSAGE event. It is also possible to send an optional object together with the message: it can contain custom parameters useful to transmit, for example, additional informations related to the message, like the text font or color, or other formatting details.
In case the target Room is not specified, the message is sent in the last Room joined by the sender.
NOTE: the event::SFSEvent::PUBLIC_MESSAGE event is dispatched if the Room is configured to allow public messaging only (see the RoomSettings::permissions parameter).
entities::SFSObject params; params.putShortString("color", "#FF0000"); sfs.send(requests::PublicMessageRequest { "Hello everyone!", ¶ms });
|
inline |
Creates a new PublicMessageRequest.
Pass it to SmartFox::send for the request to be performed.
| message | The message to be sent to all the users in the target Room. |
| params | Additional custom parameters to be sent to the message recipients (for example the color of the text, etc); nullptr if none. Only borrowed: it is copied into the request before SmartFox::send returns. |
| targetRoom | The Room where the message should be dispatched; if nullptr, the last Room joined by the user is used. |