@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:
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:
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:
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:
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:
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)
readonlyconnectionState:ConnectionState
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:493
errorMessages
Example:
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)
readonlyerrorMessages: readonlystring[]
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:494
errors
Example:
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)
readonlyerrors: readonlyErrorPayload[]
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:495
lobbies
Example:
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)
readonlylobbies: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:
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:
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:
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
