The Lobbies API lets you create multiplayer rooms where players can gather before or during gameplay. Lobbies support real-time messaging, metadata storage, and automatic P2P connection setup.
Creating a lobby
func _ready():
WavedashSDK.lobby_created.connect(_on_lobby_created)
func create_lobby():
WavedashSDK.create_lobby(WavedashConstants.LOBBY_TYPE_PUBLIC, 4)
func _on_lobby_created(response):
if response.get("success", false):
print("Created lobby: ", response["data"])
Visibility options
| Value | Constant | Description |
|---|---|---|
0 | PUBLIC | Anyone can find and join |
1 | FRIENDS_ONLY | Only friends can see and join |
2 | PRIVATE | Only joinable with the lobby ID |
Joining, leaving, and listing
WavedashSDK.join_lobby(lobby_id)
WavedashSDK.leave_lobby(lobby_id)
WavedashSDK.list_available_lobbies()
Lobby users
var users = WavedashSDK.get_lobby_users(lobby_id)
var host_id = WavedashSDK.get_lobby_host_id(lobby_id)
var count = WavedashSDK.get_num_lobby_users(lobby_id)
Messaging
WavedashSDK.send_lobby_chat_message(lobby_id, message)
func _ready():
WavedashSDK.lobby_message.connect(_on_lobby_message)
func _on_lobby_message(payload):
print(payload["username"], ": ", payload["message"])
Messages have a maximum length of 500 characters.
Invites
WavedashSDK.invite_user_to_lobby(lobby_id, user_id)
func _ready():
WavedashSDK.lobby_invite.connect(_on_lobby_invite)
func _on_lobby_invite(data):
WavedashSDK.join_lobby(data["lobbyId"])
Metadata
Only the host can set metadata. Any member can read it.
WavedashSDK.set_lobby_data(lobby_id, "gameMode", "deathmatch")
var mode = WavedashSDK.get_lobby_data(lobby_id, "gameMode")
WavedashSDK.delete_lobby_data(lobby_id, "gameMode")
Invite links
Generate a shareable invite link for the current lobby:
const response = await WavedashJS.getLobbyInviteLink(true); // true copies to clipboard
if (response.success) {
console.log("Invite link:", response.data);
}
Events
| Event | Description |
|---|---|
LOBBY_JOINED | Successfully joined a lobby |
LOBBY_USERS_UPDATED | A user joined or left |
LOBBY_MESSAGE | New message received |
LOBBY_DATA_UPDATED | Metadata changed |
LOBBY_KICKED | Removed from lobby |
LOBBY_INVITE | Received lobby invitation |