Steam-style multiplayer APIs for Glitch titles.

The multiplayer surface is split into three groups: lobby coordination, voice coordination, server browser/reservations, and short-lived auth tickets. User JWTs can infer the player from the authenticated user. Title-token clients and game clients without a Glitch user session should pass a stable player_id. Dedicated servers use server_token on heartbeat and server-side ticket validation so they do not need to hold a user JWT or title token.

These endpoints are intentionally database-agnostic from the SDK's point of view: callers work with public identifiers, metadata objects, and lifecycle events, while the backend owns how those records are stored.

Constructors

Methods

  • Add or update a favorite/history server entry for a player.

    Provide server_id for a registered Glitch server, or host plus game_port for a direct/community server. Lifecycle event: favorite.upserted.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Browse public, joinable multiplayer servers for a title.

    Default results exclude private, draining, offline, stale, expired, and full servers. Title administrators can pass include_private to inspect servers that normal clients cannot join.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Create a lobby and insert the owner as the first joined member.

    Use this when matchmaking has no suitable lobby, when a player invites friends, or when a party needs pre-game setup before server assignment. Lifecycle events: lobby.created, then lobby.joined for the owner.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

    Example

    Multiplayer.createLobby('title-uuid', {
    player_id: 'steam:76561198000000000',
    display_name: 'CinderAce',
    lobby_type: 'public',
    max_members: 4,
    region: 'us-central',
    game_mode: 'ranked_duos',
    metadata: { playlist: 'ranked', allow_voice: true }
    });
  • Create a voice room and join the creator as the first participant.

    The backend returns voice_token once. Keep it client-side and use it for voice heartbeat, packet send, packet polling, and leave calls. glitch_relay can carry base64 Opus frames for prototypes, small-party fallback, or signaling. For production-scale audio, set provider: 'external' and reuse the room/token contract with WebRTC, an SFU, Vivox, Steam Networking, or an engine-native transport. Lifecycle events: voice.room_created, voice.joined.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

    Example

    const { data } = await Multiplayer.createVoiceRoom('title-uuid', {
    player_id: 'steam:76561198000000000',
    display_name: 'CinderAce',
    lobby_id: 'lobby-uuid',
    provider: 'glitch_relay',
    topology: 'lobby',
    codec: 'opus',
    sample_rate: 48000,
    frame_duration_ms: 20,
    channels: 1,
    metadata: { push_to_talk: true }
    });
  • Delete a player's favorite/history server entry.

    The SDK sends optional player_id as a query parameter because the shared request helper treats DELETE payloads as query params. This maps cleanly to the backend's optional player identity validation for title-token clients. Lifecycle event: favorite.deleted.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • favorite_id: string

      Favorite/history UUID.

    • Optional params: MultiplayerDeleteFavoriteParams

      Optional player_id for title-token clients.

    Returns AxiosPromise<default<T>>

  • Heartbeat a multiplayer server with its dedicated server_token.

    Call every 30-60 seconds and whenever player counts, rules, or metadata change. Stale servers are hidden from default browsing and reservation. This endpoint is for dedicated/listen server processes and does not require a user JWT. Lifecycle event: server.heartbeat.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Heartbeat an open multiplayer session reservation.

    Use this after a successful reservation while the client is connecting or playing. Expired sessions are marked expired and capacity is recovered before the backend returns 409. Lifecycle events: session.heartbeat or session.expired.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Heartbeat voice participant state.

    Call every 10-30 seconds and whenever mute/deafen/speaking state changes. last_sequence tells the backend how far this participant has processed ordered packets. Expired participants are rejected with 409. Lifecycle event: voice.heartbeat.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Issue a short-lived multiplayer auth ticket for a player.

    The plain auth_ticket is returned once and only a hash is stored by the backend. Use this for P2P or dedicated-server admission before game traffic begins. remote_identity can bind the ticket to a server or validator. Lifecycle event: auth_ticket.issued.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Join a lobby or refresh an existing membership.

    This call is idempotent for a player already in the lobby and can update display name, ready state, or member metadata. It returns 409 when the lobby is full, closed, expired, or not joinable. Lifecycle event: lobby.joined.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • lobby_id: string

      Lobby UUID.

    • data: MultiplayerJoinLobbyRequest

      Player identity and optional member metadata.

    Returns AxiosPromise<default<T>>

    Example

    Multiplayer.joinLobby('title-uuid', 'lobby-uuid', {
    player_id: 'steam:76561198000000001',
    display_name: 'Nova',
    ready: false,
    member_data: { character: 'Ash', rank: 1799 }
    });
  • Join a voice room and receive a participant-scoped token.

    Rejoining with the same player is idempotent and rotates the token. The token is used by participant endpoints instead of requiring a user JWT or title token on every media request. Returns 409 when the room is closed, expired, or full. Lifecycle event: voice.joined.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • voice_room_id: string

      Voice room UUID.

    • data: MultiplayerJoinVoiceRoomRequest

      Player identity, display name, metadata, and token TTL.

    Returns AxiosPromise<default<T>>

  • Leave a lobby.

    If the owner leaves, ownership transfers to the oldest remaining joined member. If no members remain, the lobby closes. Lifecycle events: lobby.left, optionally lobby.owner_transferred or lobby.updated.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • lobby_id: string

      Lobby UUID.

    • Optional data: MultiplayerLeaveLobbyRequest

      Optional player_id for title-token clients.

    Returns AxiosPromise<default<T>>

  • Leave the current voice room for a participant token.

    This is idempotent for disconnect cleanup: room participant count is decremented once, room ownership is transferred when possible, and an empty room closes. The token remains valid only for retrying this leave call; heartbeat, send, and poll calls reject left participants. Lifecycle event: voice.left.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • List a player's server favorites or history entries.

    Use this for Steam-like favorites and recent servers tabs. Title-token clients should pass player_id; user JWT clients default to the user UUID.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • List ordered low-bandwidth lobby messages.

    Use after_sequence to poll for messages missed during reconnects or after a realtime lobby.message_sent event. This channel is for chat and control messages, not gameplay, positional data, or voice streaming.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • List active/non-expired voice rooms for a title.

    Rooms can be attached to a lobby, a server, a party, or a proximity group. Use this to discover existing voice state before joining. Lifecycle context: realtime transports should mirror voice.room_created, voice.room_updated, voice.joined, and voice.left.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • Optional params: MultiplayerVoiceRoomListParams

      Optional room filters such as lobby_id, server_id, provider, topology, state, region, and limit.

    Returns AxiosPromise<default<T>>

  • Poll ordered voice-room packets after a known sequence.

    Defaults to excluding packets sent by the caller. Use the highest returned sequence as the next after_sequence cursor. This is useful for fallback relay, WebRTC signaling, reconnect recovery, and small-party prototypes. Lifecycle event: voice.packet_polled.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Register or refresh a multiplayer server and receive a one-time server token.

    Store server_token only on the server process. The backend stores only a hash and will not return the plain token again. Counts are validated so current_players + bot_players cannot exceed max_players. Lifecycle event: server.registered.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

    Example

    Multiplayer.registerServer('title-uuid', {
    name: 'Ranked US Central 01',
    server_type: 'dedicated',
    status: 'active',
    host: '203.0.113.42',
    game_port: 7777,
    query_port: 27015,
    transport: 'udp',
    max_players: 16,
    secure: true,
    tags: ['ranked', 'duos']
    });
  • Release an open multiplayer session reservation.

    Call this on normal disconnect, failed connection attempts, or shutdown so server capacity is decremented promptly. The backend makes release safe to call more than once for an already closed reservation. Lifecycle event: session.released.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Reserve a short-lived slot on a multiplayer server before connecting.

    Reservations protect capacity during game handoff. The backend rejects stale, private, full, draining, offline, expired, or duplicate open reservations. The plain reservation_token is returned once and is used for session heartbeat/release calls. Lifecycle event: server.reserved.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • server_id: string

      Server UUID.

    • Optional data: MultiplayerReserveServerRequest

      Optional player/lobby identity and reservation TTL.

    Returns AxiosPromise<default<T>>

  • Search joinable, non-expired lobbies for a title.

    Filters are exact-match except skill_band, which the backend can use for near sorting. Default results exclude full, closed, unjoinable, and expired lobbies. Lifecycle context: clients usually call this before joinLobby; joins create a lobby.joined event on the backend.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • Optional params: MultiplayerLobbySearchParams

      Optional filters such as region, game mode, map, lobby type, skill band, and limit.

    Returns AxiosPromise<default<T>>

    Example

    Multiplayer.searchLobbies('title-uuid', {
    region: 'us-central',
    game_mode: 'ranked_duos',
    skill_band: 1840,
    limit: 25
    });
  • Send a low-bandwidth message to all lobby members.

    Payloads are capped at 4KB by the backend. Use this for chat, ready signals, invite/kick control messages, and owner-arbitrated choices. Lifecycle event: lobby.message_sent.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

    Example

    Multiplayer.sendLobbyMessage('title-uuid', 'lobby-uuid', {
    player_id: 'steam:76561198000000000',
    message_type: 'ready',
    payload: { ready: true }
    });
  • Send one ordered voice-room packet.

    audio packets should contain compact compressed frames such as base64 Opus at 48kHz mono/20ms. offer, answer, and ice packets support WebRTC signaling. control, speaking, and mute_state packets are for custom engine state. Audio payloads are capped at 16KB; non-audio packets at 4KB. Muted participants cannot send audio. Lifecycle event: voice.packet_sent.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

    Example

    await Multiplayer.sendVoicePacket({
    voice_token: voiceToken,
    packet_type: 'audio',
    payload: base64OpusFrame,
    duration_ms: 20
    });
  • Assign a registered game server to a lobby.

    This owner-only handoff mirrors Steam's SetLobbyGameServer flow. Clients should react by reserving or connecting to the assigned server, then optionally leaving the lobby. Lifecycle event: lobby.server_assigned.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Retrieve a lobby with members and assigned server information when present.

    Call this after lobby lifecycle notifications such as lobby.joined, lobby.updated, lobby.owner_transferred, or lobby.server_assigned.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • lobby_id: string

      Lobby UUID.

    Returns AxiosPromise<default<T>>

  • Retrieve a voice room with participant media states.

    Use this after voice.joined, voice.heartbeat, voice.left, or voice.room_updated to refresh in-game UI such as speaker lists, mute icons, or team voice controls.

    Type Parameters

    Parameters

    • title_id: string

      Title UUID.

    • voice_room_id: string

      Voice room UUID.

    Returns AxiosPromise<default<T>>

  • Update lobby metadata, visibility, joinability, limits, or state.

    This is owner-only. max_members cannot be lower than the current member count. Keep metadata low-frequency and mostly search/display oriented. Lifecycle event: lobby.updated.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Update owner-controlled voice room state.

    Owner-only. Use this to close a room, adjust capacity, update moderation flags, or provide external provider connection details. The backend rejects lowering max_participants below the current participant count. Lifecycle event: voice.room_updated.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Validate a multiplayer auth ticket from a trusted title/user context.

    Pass consume: true for one-time tickets to prevent replay. Dedicated servers should usually call validateAuthTicketForServer so they can use server_token instead of a title token or user JWT. Lifecycle event: auth_ticket.validated.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

  • Validate an auth ticket as a dedicated server.

    This server-token endpoint lets a dedicated server admit players without holding a user JWT or title token. Pass consume: true to prevent replay. Lifecycle event: auth_ticket.validated.

    Type Parameters

    Parameters

    Returns AxiosPromise<default<T>>

Generated using TypeDoc