Skip to main content

Client InstantChat API Reference

Instant Chat is used for instant text chatting among multiple people. All players who join a given channel can chat with each other. When all the players in a chat leave the channel or go offline, the channel is automatically deleted.

API List

APIDescription
JoinInstantChatJoin a text channel chat.
LeaveInstantChatLeave a text channel chat.
SendInstantChatTextMsgSend instant text chat message.
SendInstantChatCustomMsgSend instant custom chat message.
GetInstantChatMembersGet all players in a channel.
GetInstantChatMemberIDsGet all player IDs in a channel.
GetInstantChatMemberCountGet the num of players in a channel.

Event List

EventDescription
OnReceiveInstantChatMsgThe event will be triggered when receive channel chat message.
OnInstantChatMemberJoinedThe event will be triggered when new players joined the chat channel.
OnInstantChatMemberLeftThe event will be triggered when player left the chat channel.

API Details

JoinInstantChat

Join a text channel chat.

/**
* Join a text channel chat.
*
* @param ChatChannelId A custom unique ID used to identify the channel (in game scope), must be 127 characters or less, can use battle-session-id which base on UUID with 36 characters.
* @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 JoinInstantChat(
const FString& ChatChannelId,
TFunction<void(const FPgosResult& Ret, const FPgosClientJoinInstantChatResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
ChatChannelIdconst FString&A custom unique ID used to identify the channel (in game scope), must be 127 characters or less, can use battle-session-id which base on UUID with 36 characters.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientJoinInstantChatResult* 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

LeaveInstantChat

Leave a text channel chat.

/**
* Leave a text channel chat.
*
* @param ChatChannelId The chat channel id 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 LeaveInstantChat(
const FString& ChatChannelId,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
ChatChannelIdconst FString&The chat channel id 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

SendInstantChatTextMsg

Send instant text chat message.

/**
* Send instant text chat message.
*
* @param Params Request struct for sending instant chat 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 SendInstantChatTextMsg(
const FPgosClientSendInstantChatMsgParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosClientChatMsgInfo* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosClientSendInstantChatMsgParams&Request struct for sending instant chat message.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientChatMsgInfo* 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

SendInstantChatCustomMsg

Send instant custom chat message.

/**
* Send instant custom chat message.
*
* @param Params Request struct for sending instant chat 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 SendInstantChatCustomMsg(
const FPgosClientSendInstantChatMsgParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosClientChatMsgInfo* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosClientSendInstantChatMsgParams&Request struct for sending instant chat message.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientChatMsgInfo* 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

GetInstantChatMembers

Get all players in a channel.

/**
* Get all players in a channel.
*
* @param ChatChannelId The chat channel id.
* @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 GetInstantChatMembers(
const FString& ChatChannelId,
TFunction<void(const FPgosResult& Ret, const FPgosClientGetInstantChatMembersResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
ChatChannelIdconst FString&The chat channel id.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientGetInstantChatMembersResult* 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

GetInstantChatMemberIDs

Get all player IDs in a channel.

/**
* Get all player IDs in a channel.
*
* @param ChatChannelId The chat channel id.
* @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 GetInstantChatMemberIDs(
const FString& ChatChannelId,
TFunction<void(const FPgosResult& Ret, const FPgosClientGetInstantChatMemberIDsResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
ChatChannelIdconst FString&The chat channel id.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientGetInstantChatMemberIDsResult* 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

GetInstantChatMemberCount

Get the num of players in a channel.

/**
* Get the num of players in a channel.
*
* @param ChatChannelId The chat channel id.
* @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 GetInstantChatMemberCount(
const FString& ChatChannelId,
TFunction<void(const FPgosResult& Ret, const FPgosClientGetInstantChatMemberCountResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
ChatChannelIdconst FString&The chat channel id.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosClientGetInstantChatMemberCountResult* 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

Event Details

OnReceiveInstantChatMsg

The event will be triggered when receive channel chat message.

/**
* OnReceiveInstantChatMsg:
* The event will be triggered when receive channel chat message.
*
* @param Event Event result of receive instant chat message.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnReceiveInstantChatMsg, const FPgosClientReceiveInstantChatMsgEvt& /*Event*/);
FOnReceiveInstantChatMsg& OnReceiveInstantChatMsg() { return ReceiveInstantChatMsgDelegate; }

Type Reference:

OnInstantChatMemberJoined

The event will be triggered when new players joined the chat channel.

/**
* OnInstantChatMemberJoined:
* The event will be triggered when new players joined the chat channel.
*
* @param Event Event result of member joined instant chat.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnInstantChatMemberJoined, const FPgosClientInstantChatMemberJoinedEvt& /*Event*/);
FOnInstantChatMemberJoined& OnInstantChatMemberJoined() { return InstantChatMemberJoinedDelegate; }

Type Reference:

OnInstantChatMemberLeft

The event will be triggered when player left the chat channel.

/**
* OnInstantChatMemberLeft:
* The event will be triggered when player left the chat channel.
*
* @param Event Event result of member left instant chat.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnInstantChatMemberLeft, const FPgosClientInstantChatMemberLeftEvt& /*Event*/);
FOnInstantChatMemberLeft& OnInstantChatMemberLeft() { return InstantChatMemberLeftDelegate; }

Type Reference: