SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::requests::PrivateMessageRequest Class Reference

Sends a private chat message. More...

#include <PrivateMessageRequest.h>

Public Member Functions

 PrivateMessageRequest (std::string message, int32_t recipientId, const entities::SFSObject *params=nullptr)
 Creates a new PrivateMessageRequest.

Detailed Description

Sends a private chat message.

The private message is dispatched to a specific User, in any server Room, or even in no Room at all. The message is delivered by means of the event::SFSEvent::PRIVATE_MESSAGE event. It is also returned to the sender: this allows showing the messages in the correct order in the application interface. It is also possible to send an optional object together with the message: it can contain custom parameters useful to transmit, for example, additional data, like text font or color etc.

sfs.send(requests::PrivateMessageRequest { "Hi there!", user->getId() });
See also
event::SFSEvent::PRIVATE_MESSAGE

Constructor & Destructor Documentation

◆ PrivateMessageRequest()

sfs3::requests::PrivateMessageRequest::PrivateMessageRequest ( std::string message,
int32_t recipientId,
const entities::SFSObject * params = nullptr )
inline

Creates a new PrivateMessageRequest.

Pass it to SmartFox::send for the request to be performed.

Parameters
messageThe message to be sent to the recipient user.
recipientIdThe id of the user to which the message is to be sent.
paramsAdditional custom parameters to be sent to the message recipient (for example the color of the text, etc); nullptr if none. Only borrowed: it is copied into the request before SmartFox::send returns.
See also
SmartFox::send
entities::SFSObject

The documentation for this class was generated from the following file:
  • requests/PrivateMessageRequest.h