Party Chat
Last updated on
When a party has been formed, its members can use the chat feature to communicate with each other. Every message sent will be received by all of the party members.
Send a Party Chat
The Lobby service will automatically direct a player's messages to their own party, so the player doesn't need to know their Party ID. The Party ID will be obtained automatically after the player has already joined the party.
- Unreal Engine
- Unity
FRegistry::Lobby.Connect();
FRegistry::Lobby.SetPartyMessageResponseDelegate(AccelByte::Api::Lobby::FPartyChatResponse::CreateLambda([](const FAccelByteModelsPartyMessageResponse& Result)
{
if (Result.Code == "0")
{
// Do something if PartyMessageResponseDelegate has been retrieved successfully
}
else
{
// Do something if PartyMessageResponseDelegate has an error
}
}));
FString Message = FString("Your Message");
FRegistry::Lobby.SendPartyMessage(Message);
string message = "Your Message";
AccelBytePlugin.GetLobby().Connect();
AccelBytePlugin.GetLobby().SendPartyChat(message, result =>
{
if (result.IsError)
{
// Do something if SendPartyChat has an error
Debug.Log($"Error SendPartyChat, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if SendPartyChat has been successful
}
});
Receive a Party Chat
A party chat can be received by registering to a party chat event.
- Unreal Engine
- Unity
FRegistry::Lobby.SetPartyChatNotifDelegate(AccelByte::Api::Lobby::FPartyChatNotif::CreateLambda([](const FAccelByteModelsPartyMessageNotice& Result)
{
// Do something if PartyChatMessageNotifDelegate has been retrieved successfully
}));
AccelBytePlugin.GetLobby().PartyChatReceived += result =>
{
if (result.IsError)
{
// Do something if PartyChatReceived has an error
Debug.Log($"Error PartyChatReceived, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if PartyChatReceived has been successful
}
};