Skip to main content

Client PersonalChat API Reference

The Personal Chat feature allows for one-on-one chat with other players.

API List

APIDescription
SendPersonalTextMsgSend personal chat text message
SendPersonalCustomMsgSend personal chat custom message
GetMyPersonalChatListGet my personal chat list
GetPersonalMsgListGet chat message list with a player
ActivePersonalChatActive a personal chat. When activated, OnUnreadPersonalMsgCountNotifyEvt will be pushed, and subsequent personal chat messages currently in progress are automatically marked as read
GetActivePersonalChatGet the activated personal chat.
ClearPersonalUnreadCountMark messages with someone as all read
RemovePersonalChatRemove a personal chat, all message with this player will be removed

Event List

EventDescription
OnUnreadPersonalMsgCountNotifyThe event will be triggered after login PGOS and when the unread count of personal message changed.
OnReceivePersonalMsgThe 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:

ParamTypeDescription
Paramsconst FPgosClientSendPersonalMsgParams&Request struct for sending text message
ResultCallbackTFunction<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:

ParamTypeDescription
Paramsconst FPgosClientSendPersonalMsgParams&Request struct for sending custom message
ResultCallbackTFunction<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:

ParamTypeDescription
ResultCallbackTFunction<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:

ParamTypeDescription
PeerPlayerIdconst FString&The peer player ID
StartSeqint64The start sequence number of the message to query, 0 means start from the latest message.
Countint32The count of message to get
ResultCallbackTFunction<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:

ParamTypeDescription
PeerPlayerIdconst 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:

ParamTypeDescription
PeerPlayerIdconst FString&The player chat with. If empty, it means all players
ResultCallbackTFunction<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:

ParamTypeDescription
PeerPlayerIdconst FString&The personal chat to remove. If empty, it means all players
ResultCallbackTFunction<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: