Skip to main content

Register Player to Session

Last updated on

When the game host detects that a player has joined a session, the RegisterPlayer() function will be called to update the session data with the new player.

FString SessionId { "KnownSessionId" };
FString UserId { "IDToAdd"};
bool bAsSpectator {false};

ApiClient->SessionBrowser.RegisterPlayer(SessionId, UserId, bAsSpectator,
THandler<FAccelByteModelsSessionBrowserAddPlayerResponse>::CreateLambda([](const FAccelByteModelsSessionBrowserAddPlayerResponse& Result)
{
// Do something when request success
}), FErrorHandler::CreateLambda([](const int32 Code, const FString& Msg)
{
// Do something when request error
}));