Skip to main content

Personal Chat

Last updated on

Players can communicate with other players using personal chat.

Send a Personal Chat

A player can send a personal message to any other player, if they know their User ID.

FRegistry::Lobby.Connect();
FRegistry::Lobby.SetPrivateMessageResponseDelegate(AccelByte::Api::Lobby::FPersonalChatResponse::CreateLambda([](const FAccelByteModelsPersonalMessageResponse& Result)
{
if (Result.Code == "0")
{
// Do something if SendPrivateMessage has been successful
}
else
{
// Do something if SendPrivateMessage has an error
}
}));

FString UserId = FString("SomeTargetUserId");
FString Message = FString("Your Message");
FRegistry::Lobby.SendPrivateMessage(UserId, Message);

Receive a Personal Chat

Personal chats can be received by registering to the personal chat event.

FRegistry::Lobby.SetPrivateMessageNotifDelegate(AccelByte::Api::Lobby::FPersonalChatNotif::CreateLambda([](const FAccelByteModelsPersonalMessageNotice& Result)
{
// Do something if PrivateMessageNotifDelegate has been retrieved successfully
}));