> ## 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.

# Join lobbies

> Join PlayFab Lobbies using a lobby ID, connection string, or invitation, and handle member joins, initial properties, and access policy restrictions.

# Joining lobbies and connection strings

Players join lobbies by providing the lobby service with a lobby's "connection string", an opaque identifier which grants membership to the lobby.

Players can discover connection strings and join lobbies in the following ways.

1. By using in-game invites—A member of a lobby may invite another player to that lobby directly via the lobby service. This will share the lobby's connection string with the invited player. These invites work cross-platform but only work in-game. For more information, see [Lobby invites](/services/playfab/multiplayer/lobby/lobby-invites)
2. By using platform-provided invites—Members of the lobby can directly share the lobby's connection string with other players over platform-specific invite mechanisms. These invites will not work cross-platform but can be received without the recipient already running the game.
3. By searching for available lobbies with [FindLobbies](/services/playfab/multiplayer/lobby/find-lobbies) and joining an available lobby
4. By sharing the lobby's connection string via any out-of-band, custom discovery mechanism

<Note>
  Only players (i.e. title\_player\_account PlayFab entities) can join lobbies as members. Game servers (i.e. game\_server PlayFab entities) cannot join lobbies as members. For more information on the how game servers interact with lobbies, see [Game Servers and Lobbies](/services/playfab/multiplayer/lobby/lobby-server-overview).
</Note>

## Connection strings and Lobby IDs

Aside from connection strings, lobbies have another identifer known as **LobbyId**. **LobbyId** is the unique identifier for a lobby. Titles may use **LobbyId** to distinguish between multiple lobbies that a player is in, but LobbyIds cannot be used to join the lobbies or directly query them for any information which requires membership. Therefore, your title doesn't have to keep **LobbyId** a secret. Connection strings, on the other hand, grant access to lobbies so care should be taken to keep from exposing them to unwanted, outside parties.

## Example joining a lobby using the Lobby and Matchmaking SDK

Here's a brief snippet which demonstrates passing a connection string to the **PFMultiplayerJoinLobby** API provided by the SDK.

In this snippet, the connection string could be provided by any of the discovery mechanisms mentioned above: in-game invites, platform-specific invites, or filtered lobby searches.

```cpp theme={null}
// Initialize the member properties for the newly joining member
const char* playerColorPropertyKey = "PlayerColor";
const char* playerColorPropertyValue = MyGame::GetPlayerColorString(localUser);

PFLobbyJoinConfiguration joinConfig;
joinConfig.memberPropertyCount = 1;
joinConfig.memberPropertyKeys = &playerColorPropertyKey;
joinConfig.memberPropertyValues = &playerColorPropertyValue;

// Join the lobby using the connection string
HRESULT hr = PFMultiplayerJoinLobby(
    g_pfmHandle,
    &localUser,
    connectionString,
    &joinConfig,
    nullptr,
    nullptr);
```

## See also

* [Find lobbies](/services/playfab/multiplayer/lobby/find-lobbies)
* [Create searchable lobbies](/services/playfab/multiplayer/lobby/define-search-keywords)
* [Lobby and matchmaking](/services/playfab/multiplayer/lobby/lobby-and-matchmaking)
* [Lobby properties](/services/playfab/multiplayer/lobby/lobby-properties)
* [Create a lobby](/services/playfab/multiplayer/lobby/create-a-lobby)


## Related topics

- [PFMultiplayerJoinLobby](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayerjoinlobby.md)
- [PFMultiplayerCreateAndJoinLobby](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayercreateandjoinlobby.md)
- [PFMultiplayerJoinLobbyAsServer](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/functions/pfmultiplayerjoinlobbyasserver.md)
- [Lobby.Id](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/Lobby/Id.md)
- [PFLobbyJoinLobbyCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pflobby/structs/pflobbyjoinlobbycompletedstatechange.md)
