SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::event::PrivateMessage Struct Reference

Dispatched when a private message is received. More...

#include <SFSEvent.h>

Public Attributes

std::shared_ptr< entities::Usersender
 The user who sent the message.
std::string message
 The message.
std::shared_ptr< entities::SFSObjectdata
 The custom parameters the sender attached to the message, or nullptr if none.

Detailed Description

Dispatched when a private message is received.

It is caused by a requests::PrivateMessageRequest from any user in the Zone, including this client: the server echoes the messages back, so that the sender knows the message reached the recipient and can render the conversation in the right order.

NOTE: on the echo there is no standard way to know who the message was sent to. When the sender chats privately with more than one user at the same time, in separate windows or tabs, put something like the id of the recipient in data to tell the conversations apart.

The sender may be in a Room this client has not joined, in which case sender is a detached snapshot built from the data the server attached to the message: it belongs to no user manager and is not kept up to date.

See also
requests::PrivateMessageRequest
entities::User
SFSEvent::PUBLIC_MESSAGE

The documentation for this struct was generated from the following file: