Client PersonalChat API Reference
The Personal Chat feature allows for one-on-one chat with other players.
API List
| API | Description |
|---|---|
| SendPersonalTextMsg | Send personal chat text message |
| SendPersonalCustomMsg | Send personal chat custom message |
| GetMyPersonalChatList | Get my personal chat list |
| GetPersonalMsgList | Get chat message list with a player |
| ActivePersonalChat | Active a personal chat. When activated, OnUnreadPersonalMsgCountNotifyEvt will be pushed, and subsequent personal chat messages currently in progress are automatically marked as read |
| GetActivePersonalChat | Get the activated personal chat. |
| ClearPersonalUnreadCount | Mark messages with someone as all read |
| RemovePersonalChat | Remove a personal chat, all message with this player will be removed |
Event List
| Event | Description |
|---|---|
| SetOnUnreadPersonalMsgCountNotify | The event will be triggered after login PGOS and when the unread count of personal message changed. |
| SetOnReceivePersonalMsg | The event will be triggered when receive personal chat message. |
API Details
SendPersonalTextMsg
Send personal chat text message
/**
* Send personal chat text message
*
* @param params Request struct 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 SendPersonalTextMsg(
const SendPersonalMsgParams& params,
PgosDataCallback<PersonalMsgInfo> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SendPersonalMsgParams& | Request struct for sending text message |
| result_callback | PgosDataCallback<PersonalMsgInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SendPersonalCustomMsg
Send personal chat custom message
/**
* Send personal chat custom message
*
* @param params Request struct 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 SendPersonalCustomMsg(
const SendPersonalMsgParams& params,
PgosDataCallback<PersonalMsgInfo> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SendPersonalMsgParams& | Request struct for sending custom message |
| result_callback | PgosDataCallback<PersonalMsgInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
GetMyPersonalChatList
Get my personal chat list
/**
* Get my personal chat list
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetMyPersonalChatList(
PgosDataCallback<GetMyPersonalChatListResult> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| result_callback | PgosDataCallback<GetMyPersonalChatListResult> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
GetPersonalMsgList
Get chat message list with a player
/**
* Get chat message list with a player
*
* @param peer_player_id The peer player ID
* @param start_seq The start sequence number of the message to query, 0 means start from the latest message.
* @param count The count of message to get
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetPersonalMsgList(
const pgos::pstring& peer_player_id,
int64_t start_seq,
int32_t count,
PgosDataCallback<GetPersonalChatMsgListResult> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| peer_player_id | const std::string& | The peer player ID |
| start_seq | int64_t | The start sequence number of the message to query, 0 means start from the latest message. |
| count | int32_t | The count of message to get |
| result_callback | PgosDataCallback<GetPersonalChatMsgListResult> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
ActivePersonalChat
Active a personal chat. When activated, OnUnreadPersonalMsgCountNotifyEvt will be pushed, and subsequent personal chat messages currently in progress are automatically marked as read
/**
* Active a personal chat. When activated, OnUnreadPersonalMsgCountNotifyEvt will be pushed, and subsequent personal chat messages currently in progress are automatically marked as read
*
* @param peer_player_id The player to set as active. If empty, it means no personal chat will be activated.
*/
void ActivePersonalChat(
const pgos::pstring& peer_player_id);
Parameters:
| Param | Type | Description |
|---|---|---|
| peer_player_id | const std::string& | The player to set as active. If empty, it means no personal chat will be activated. |
Return: void
GetActivePersonalChat
Get the activated personal chat.
/**
* Get the activated personal chat.
*
* @return Player ID of the activated personal chat. If empty, it means no personal chat is activated.
*/
pgos::pstring GetActivePersonalChat();
Parameters:
(No parameters)
Return: pgos::pstring
Player ID of the activated personal chat. If empty, it means no personal chat is activated.
ClearPersonalUnreadCount
Mark messages with someone as all read
/**
* Mark messages with someone as all read
*
* @param peer_player_id The player chat with. If empty, it means all players
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void ClearPersonalUnreadCount(
const pgos::pstring& peer_player_id,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| peer_player_id | const std::string& | The player chat with. If empty, it means all players |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
RemovePersonalChat
Remove a personal chat, all message with this player will be removed
/**
* Remove a personal chat, all message with this player will be removed
*
* @param peer_player_id The personal chat to remove. If empty, it means all players
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void RemovePersonalChat(
const pgos::pstring& peer_player_id,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| peer_player_id | const std::string& | The personal chat to remove. If empty, it means all players |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
Event Details
SetOnUnreadPersonalMsgCountNotify
The event will be triggered after login PGOS and when the unread count of personal message changed.
/**
* OnSetOnUnreadPersonalMsgCountNotify:
* The event will be triggered after login PGOS and when the unread count of personal message changed.
*
* @param event Event result of unread message count changed.
*/
void SetOnUnreadPersonalMsgCountNotify(
const UnreadMsgCountNotifyEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const UnreadMsgCountNotifyEvt& | Event result of unread message count changed. |
SetOnReceivePersonalMsg
The event will be triggered when receive personal chat message.
/**
* OnSetOnReceivePersonalMsg:
* The event will be triggered when receive personal chat message.
*
* @param event Event result of receive personal chat message.
*/
void SetOnReceivePersonalMsg(
const ReceivePersonalMsgEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const ReceivePersonalMsgEvt& | Event result of receive personal chat message. |