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
| API | Description |
|---|---|
| JoinInstantChat | Join a text channel chat. |
| LeaveInstantChat | Leave a text channel chat. |
| SendInstantChatTextMsg | Send instant text chat message. |
| SendInstantChatCustomMsg | Send instant custom chat message. |
| GetInstantChatMembers | Get all players in a channel. |
| GetInstantChatMemberIDs | Get all player IDs in a channel. |
| GetInstantChatMemberCount | Get the num of players in a channel. |
Event List
| Event | Description |
|---|---|
| OnReceiveInstantChatMsg | The event will be triggered when receive channel chat message. |
| OnInstantChatMemberJoined | The event will be triggered when new players joined the chat channel. |
| OnInstantChatMemberLeft | The 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:
| Param | Type | Description |
|---|---|---|
| ChatChannelId | const 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. |
| ResultCallback | TFunction<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:
| Param | Type | Description |
|---|---|---|
| ChatChannelId | const FString& | The chat channel id to leave. |
| 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
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:
| Param | Type | Description |
|---|---|---|
| Params | const FPgosClientSendInstantChatMsgParams& | Request struct for sending instant chat message. |
| ResultCallback | TFunction<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:
| Param | Type | Description |
|---|---|---|
| Params | const FPgosClientSendInstantChatMsgParams& | Request struct for sending instant chat message. |
| ResultCallback | TFunction<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:
| Param | Type | Description |
|---|---|---|
| ChatChannelId | const FString& | The chat channel id. |
| ResultCallback | TFunction<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:
| Param | Type | Description |
|---|---|---|
| ChatChannelId | const FString& | The chat channel id. |
| ResultCallback | TFunction<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:
| Param | Type | Description |
|---|---|---|
| ChatChannelId | const FString& | The chat channel id. |
| ResultCallback | TFunction<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: