Client PublicChat API Reference
The Public Chat is a service that allows all the players to join the same global chat channel and take free talk with each other.
API List
| API | Description |
|---|---|
| JoinPublicChat | Join a public chat. |
| LeavePublicChat | Leave a public chat. |
| SendPublicChatTextMsg | Send public chat text message. |
| SendPublicChatCustomMsg | Send public chat custom message. |
| GetPublicChatMentionedInfo | Get latest record mentioning me in the channel. |
| ClearPublicChatMentionedInfo | Clear record mentioning me in the channel. |
Event List
| Event | Description |
|---|---|
| SetOnReceivePublicChatMsg | The event will be triggered when receive public chat message. |
| SetOnPublicChatNewMentioned | The event will be triggered when a new mention of a channel is received. |
API Details
JoinPublicChat
Join a public chat.
/**
* Join a public chat.
*
* @param channel_name The name of the channel to join which can be retrieved from the portal, currently only the name 'Default' is valid.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void JoinPublicChat(
const pgos::pstring& channel_name,
PgosDataCallback<JoinPublicChatResult> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| channel_name | const std::string& | The name of the channel to join which can be retrieved from the portal, currently only the name 'Default' is valid. |
| result_callback | PgosDataCallback<JoinPublicChatResult> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
LeavePublicChat
Leave a public chat.
/**
* Leave a public chat.
*
* @param channel_name The channel to leave.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void LeavePublicChat(
const pgos::pstring& channel_name,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| channel_name | const std::string& | The channel to leave. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SendPublicChatTextMsg
Send public chat text message.
/**
* Send public chat text message.
*
* @param params Request parameters for sending text message.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SendPublicChatTextMsg(
const SendPublicChatMsgParams& params,
PgosDataCallback<SendPublicChatMsgResult> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SendPublicChatMsgParams& | Request parameters for sending text message. |
| result_callback | PgosDataCallback<SendPublicChatMsgResult> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SendPublicChatCustomMsg
Send public chat custom message.
/**
* Send public chat custom message.
*
* @param params Request parameters for sending custom message.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SendPublicChatCustomMsg(
const SendPublicChatMsgParams& params,
PgosDataCallback<SendPublicChatMsgResult> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SendPublicChatMsgParams& | Request parameters for sending custom message. |
| result_callback | PgosDataCallback<SendPublicChatMsgResult> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
GetPublicChatMentionedInfo
Get latest record mentioning me in the channel.
/**
* Get latest record mentioning me in the channel.
*
* @param channel_name The name of the channel.
* @param dst The latest record mentioned me.
* @return True if there are any mentions of me.
*/
bool GetPublicChatMentionedInfo(
const pgos::pstring& channel_name,
PublicChatMentionedInfo& dst);
Parameters:
| Param | Type | Description |
|---|---|---|
| channel_name | const std::string& | The name of the channel. |
| dst | PublicChatMentionedInfo& | The latest record mentioned me. |
Return: bool
True if there are any mentions of me.
ClearPublicChatMentionedInfo
Clear record mentioning me in the channel.
/**
* Clear record mentioning me in the channel.
*
* @param channel_name The name of the channel. If empty, it means all channels.
*/
void ClearPublicChatMentionedInfo(
const pgos::pstring& channel_name);
Parameters:
| Param | Type | Description |
|---|---|---|
| channel_name | const std::string& | The name of the channel. If empty, it means all channels. |
Return: void
Event Details
SetOnReceivePublicChatMsg
The event will be triggered when receive public chat message.
/**
* OnSetOnReceivePublicChatMsg:
* The event will be triggered when receive public chat message.
*
* @param event Result of the event receive public chat message.
*/
void SetOnReceivePublicChatMsg(
const ReceivePublicChatMsgEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const ReceivePublicChatMsgEvt& | Result of the event receive public chat message. |
SetOnPublicChatNewMentioned
The event will be triggered when a new mention of a channel is received.
/**
* OnSetOnPublicChatNewMentioned:
* The event will be triggered when a new mention of a channel is received.
*
* @param event Event results received for new channel mentions.
*/
void SetOnPublicChatNewMentioned(
const PublicChatNewMentionedEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const PublicChatNewMentionedEvt& | Event results received for new channel mentions. |