Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / LobbyListSession

Interface: LobbyListSession ​

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:491

Public, unauthenticated subscription to the live lobby list.

Returned by LobbiesResource.subscribeList. Opens ${wsUrl}/lobbies with no token and no Sec-WebSocket-Protocol, replaces its state from each pushed snapshot, and auto-reconnects on abnormal close (the one behavior added over the per-lobby LobbySession). On reconnect the server sends a fresh full snapshot, so no replay or cursor is needed.

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

console.log(lobbyListSession)

Properties ​

__v_skip ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { __v_skip } = lobbyListSession

console.log(__v_skip)

readonly __v_skip: true

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:492


close ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { close } = lobbyListSession

console.log(close)

close: () => void

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:498

Returns ​

void


connect ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { connect } = lobbyListSession

console.log(connect)

connect: () => Promise<LobbyListSession>

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:499

Returns ​

Promise<LobbyListSession>


connectionState ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { connectionState } = lobbyListSession

console.log(connectionState)

readonly connectionState: ConnectionState

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:493


errorMessages ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { errorMessages } = lobbyListSession

console.log(errorMessages)

readonly errorMessages: readonly string[]

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:494


errors ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { errors } = lobbyListSession

console.log(errors)

readonly errors: readonly ErrorPayload[]

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:495


lobbies ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { lobbies } = lobbyListSession

console.log(lobbies)

readonly lobbies: PublicLobbySummary[] | undefined

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:497

Latest public lobby list, or undefined before the first snapshot.


on ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { on } = lobbyListSession

console.log(on)

on: <TKey>(event, listener) => () => void

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:500

Type Parameters ​

TKey ​

TKey extends keyof LobbyListSessionEvents

Parameters ​

event ​

TKey

listener ​

(value) => void

Returns ​

() => void


onSnapshot ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { onSnapshot } = lobbyListSession

console.log(onSnapshot)

onSnapshot: (listener) => () => void

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:505

Alias for on('snapshot', listener), returning an unsubscribe function.

Parameters ​

listener ​

(lobbies) => void

Returns ​

() => void


ping ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// The public lobby list needs no credential; it auto-reconnects.
const lobbyListSession = simulatorClient.lobbies.subscribeList()

const { ping } = lobbyListSession

console.log(ping)

ping: (nonce?) => void

Defined in: packages/ts-sdk/src/resources/lobby-types.ts:506

Parameters ​

nonce? ​

string

Returns ​

void

Released under the MIT License.