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 |
|---|---|
| OnUnreadPersonalMsgCountNotify | The event will be triggered after login PGOS and when the unread count of personal message changed. |
| OnReceivePersonalMsg | 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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void SendPersonalTextMsg(
const FPgosClientSendPersonalMsgParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosClientPersonalMsgInfo* Data)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| Params | const FPgosClientSendPersonalMsgParams& | Request struct for sending text message |
| ResultCallback | TFunction<void(const FPgosResult& Ret, const FPgosClientPersonalMsgInfo* Data)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
SendPersonalCustomMsg
Send personal chat custom message
/**
* Send personal chat custom message
*
* @param Params Request struct for sending custom message
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void SendPersonalCustomMsg(
const FPgosClientSendPersonalMsgParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosClientPersonalMsgInfo* Data)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| Params | const FPgosClientSendPersonalMsgParams& | Request struct for sending custom message |
| ResultCallback | TFunction<void(const FPgosResult& Ret, const FPgosClientPersonalMsgInfo* Data)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
GetMyPersonalChatList
Get my personal chat list
/**
* Get my personal chat list
*
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void GetMyPersonalChatList(
TFunction<void(const FPgosResult& Ret, const FPgosClientGetMyPersonalChatListResult* Data)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| ResultCallback | TFunction<void(const FPgosResult& Ret, const FPgosClientGetMyPersonalChatListResult* Data)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
GetPersonalMsgList
Get chat message list with a player
/**
* Get chat message list with a player
*
* @param PeerPlayerId The peer player ID
* @param StartSeq 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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void GetPersonalMsgList(
const FString& PeerPlayerId,
int64 StartSeq,
int32 Count,
TFunction<void(const FPgosResult& Ret, const FPgosClientGetPersonalChatMsgListResult* Data)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| PeerPlayerId | const FString& | The peer player ID |
| StartSeq | int64 | The start sequence number of the message to query, 0 means start from the latest message. |
| Count | int32 | The count of message to get |
| ResultCallback | TFunction<void(const FPgosResult& Ret, const FPgosClientGetPersonalChatMsgListResult* Data)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
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 PeerPlayerId The player to set as active. If empty, it means no personal chat will be activated.
*/
void ActivePersonalChat(
const FString& PeerPlayerId) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| PeerPlayerId | const FString& | 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.
*/
FString GetActivePersonalChat() const;
Parameters:
(No parameters)
Return: FString
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 PeerPlayerId The player chat with. If empty, it means all players
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void ClearPersonalUnreadCount(
const FString& PeerPlayerId,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| PeerPlayerId | const FString& | The player chat with. If empty, it means all players |
| ResultCallback | TFunction<void(const FPgosResult& Ret)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
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 PeerPlayerId The personal chat to remove. If empty, it means all players
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void RemovePersonalChat(
const FString& PeerPlayerId,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| PeerPlayerId | const FString& | The personal chat to remove. If empty, it means all players |
| ResultCallback | TFunction<void(const FPgosResult& Ret)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
Event Details
OnUnreadPersonalMsgCountNotify
The event will be triggered after login PGOS and when the unread count of personal message changed.
/**
* OnUnreadPersonalMsgCountNotify:
* 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.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnUnreadPersonalMsgCountNotify, const FPgosClientUnreadMsgCountNotifyEvt& /*Event*/);
FOnUnreadPersonalMsgCountNotify& OnUnreadPersonalMsgCountNotify() { return UnreadPersonalMsgCountNotifyDelegate; }
Type Reference:
OnReceivePersonalMsg
The event will be triggered when receive personal chat message.
/**
* OnReceivePersonalMsg:
* The event will be triggered when receive personal chat message.
*
* @param Event Event result of receive personal chat message.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnReceivePersonalMsg, const FPgosClientReceivePersonalMsgEvt& /*Event*/);
FOnReceivePersonalMsg& OnReceivePersonalMsg() { return ReceivePersonalMsgDelegate; }
Type Reference: