> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PFMultiplayerJoinLobby

> PFMultiplayerJoinLobby reference for joining an existing PlayFab lobby as the local PlayFab entity using a connection string in the Multiplayer C++ SDK.

Join a lobby as the local PlayFab entity.

## Syntax

```cpp theme={null}
HRESULT PFMultiplayerJoinLobby(  
    PFMultiplayerHandle handle,  
    const PFEntityKey* newMember,  
    const char* connectionString,  
    const PFLobbyJoinConfiguration* configuration,  
    void* asyncContext,  
    PFLobbyHandle* lobby  
)  
```

### Parameters

**`handle`**   PFMultiplayerHandle

The handle of the PFMultiplayer API instance.

**`newMember`**   [PFEntityKey\*](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/pfentitykey_clientsdk)

The local entity joining the lobby.

**`connectionString`**   char\*\
*is null-terminated*

The connection string used by the entity to join the lobby.

**`configuration`**   [PFLobbyJoinConfiguration\*](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinconfiguration)

The initial configuration data used when joining the lobby.

**`asyncContext`**   void\*\
*optional*

An optional, app-defined, pointer-sized context value that can be used to associate the completion state change with this call.

**`lobby`**   PFLobbyHandle\*\
*optional, library-allocated output*

The optional, output lobby object which can be used to queue operations for immediate execution of this operation completes.

### Return value

Type: HRESULT

`S_OK` if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [PFMultiplayerGetErrorMessage()](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage).

## Remarks

This is an asynchronous operation. Upon successful completion, the title will be provided a [PFLobbyMemberAddedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbymemberaddedstatechange) followed by a [PFLobbyUpdatedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyupdatedstatechange) and [PFLobbyJoinLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange) with the [PFLobbyJoinLobbyCompletedStateChange::result](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange) field set to `S_OK`. Upon a failed completion, the title will be provided a [PFLobbyJoinLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange) with the [PFLobbyJoinLobbyCompletedStateChange::result](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange) field set to a failure.

## Requirements

**Header:** PFLobby.h

## See also

[PFLobby members](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/pflobby_members)


## Related topics

- [Join lobbies](/services/playfab/multiplayer/lobby/join-lobbies.md)
- [Integrate Party with Lobby using Multiplayer SDK](/services/playfab/multiplayer/networking/party-lobby-integration.md)
- [PFLobbyGetLobbyProperty](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetlobbyproperty.md)
- [PFLobbyGetLobbyPropertyKeys](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pflobbygetlobbypropertykeys.md)
- [Use lobby and matchmaking together](/services/playfab/multiplayer/lobby/lobby-and-matchmaking.md)
