View Source Code

Lobbies

Find Or Create Lobby

Finds a lobby or creates one if there are no available spots for players.

Request

  • version
    string
  • regions
    optional array of strings
  • tags
    optional combination of empty object and record of strings
  • players
    array of empty objects
  • noWait
    optional boolean
  • createConfig
    object
    • createConfig.region
      string
    • createConfig.tags
      optional combination of empty object and record of strings
    • createConfig.maxPlayers
      number
    • createConfig.maxPlayersDirect
      number

Response

  • lobby
    object
    • lobby.id
      string
    • lobby.version
      string
    • lobby.tags
      combination of empty object and record of strings
    • lobby.createdAt
      number
    • lobby.readyAt
      optional number
    • lobby.players
      number
    • lobby.maxPlayers
      number
    • lobby.maxPlayersDirect
      number
    • lobby.backend
      union of objects
        • lobby.backend.test
          empty object
        • lobby.backend.localDevelopment
          object
          • lobby.backend.localDevelopment.ports
            combination of empty object and record of objects
        • lobby.backend.server
          object
          • lobby.backend.server.serverId
            string
          • lobby.backend.server.ports
            optional combination of empty object and record of objects
  • players
    array of objects
    • players.token
      string
    • players.id
      string

Usage

1. Install the module

2. Use this script

const data = await ctx.modules.lobbies.find_or_create({
  // Request body
});