Skip to main content

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

APIDescription
JoinPublicChatJoin a public chat.
LeavePublicChatLeave a public chat.
SendPublicChatTextMsgSend public chat text message.
SendPublicChatCustomMsgSend public chat custom message.
GetPublicChatMentionedInfoGet latest record mentioning me in the channel.
ClearPublicChatMentionedInfoClear record mentioning me in the channel.

Event List

EventDescription
OnReceivePublicChatMsgThe event will be triggered when receive public chat message.
OnPublicChatNewMentionedThe 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 ChannelName The name of the channel to join which can be retrieved from the portal, currently only the name 'Default' is valid.
* @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 JoinPublicChat(
const FString& ChannelName,
TFunction<void(const FPgosResult& Ret, const FPgosClientJoinPublicChatResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
ChannelNameconst FString&The name of the channel to join which can be retrieved from the portal, currently only the name 'Default' is valid.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientJoinPublicChatResult* 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

LeavePublicChat

Leave a public chat.

/**
* Leave a public chat.
*
* @param ChannelName The channel to leave.
* @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 LeavePublicChat(
const FString& ChannelName,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
ChannelNameconst FString&The channel to leave.
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

SendPublicChatTextMsg

Send public chat text message.

/**
* Send public chat text message.
*
* @param Params Request parameters 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 SendPublicChatTextMsg(
const FPgosClientSendPublicChatMsgParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosClientSendPublicChatMsgResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosClientSendPublicChatMsgParams&Request parameters for sending text message.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientSendPublicChatMsgResult* 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

SendPublicChatCustomMsg

Send public chat custom message.

/**
* Send public chat custom message.
*
* @param Params Request parameters 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 SendPublicChatCustomMsg(
const FPgosClientSendPublicChatMsgParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosClientSendPublicChatMsgResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosClientSendPublicChatMsgParams&Request parameters for sending custom message.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientSendPublicChatMsgResult* 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

GetPublicChatMentionedInfo

Get latest record mentioning me in the channel.

/**
* Get latest record mentioning me in the channel.
*
* @param ChannelName The name of the channel.
* @param Dst The latest record mentioned me.
* @return True if there are any mentions of me.
*/
bool GetPublicChatMentionedInfo(
const FString& ChannelName,
FPgosClientPublicChatMentionedInfo& Dst) const;

Parameters:

ParamTypeDescription
ChannelNameconst FString&The name of the channel.
DstFPgosClientPublicChatMentionedInfo&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 ChannelName The name of the channel. If empty, it means all channels.
*/
void ClearPublicChatMentionedInfo(
const FString& ChannelName) const;

Parameters:

ParamTypeDescription
ChannelNameconst FString&The name of the channel. If empty, it means all channels.

Return: void

Event Details

OnReceivePublicChatMsg

The event will be triggered when receive public chat message.

/**
* OnReceivePublicChatMsg:
* The event will be triggered when receive public chat message.
*
* @param Event Result of the event receive public chat message.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnReceivePublicChatMsg, const FPgosClientReceivePublicChatMsgEvt& /*Event*/);
FOnReceivePublicChatMsg& OnReceivePublicChatMsg() { return ReceivePublicChatMsgDelegate; }

Type Reference:

OnPublicChatNewMentioned

The event will be triggered when a new mention of a channel is received.

/**
* OnPublicChatNewMentioned:
* The event will be triggered when a new mention of a channel is received.
*
* @param Event Event results received for new channel mentions.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnPublicChatNewMentioned, const FPgosClientPublicChatNewMentionedEvt& /*Event*/);
FOnPublicChatNewMentioned& OnPublicChatNewMentioned() { return PublicChatNewMentionedDelegate; }

Type Reference: