Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / LobbyListSessionEvents

Interface: LobbyListSessionEvents ​

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

Events emitted by a LobbyListSession.

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()

// Listener payloads are typed by the event name.
const stopListening = lobbyListSession.on('change', changePayload => {
  console.log(changePayload)
})

stopListening()

Properties ​

change ​

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()

// Listener payloads are typed by the event name.
const stopListening = lobbyListSession.on('change', changePayload => {
  console.log(changePayload)
})

stopListening()

change: LobbyListSessionState

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

Aggregated state snapshot emitted on every change.


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()

// Listener payloads are typed by the event name.
const stopListening = lobbyListSession.on('connectionState', connectionStatePayload => {
  console.log(connectionStatePayload)
})

stopListening()

connectionState: ConnectionState

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

Underlying socket connection state transitions.


error ​

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()

// Listener payloads are typed by the event name.
const stopListening = lobbyListSession.on('error', errorPayload => {
  console.log(errorPayload)
})

stopListening()

error: ErrorPayload

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

SDK or server error payloads.


message ​

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()

// Listener payloads are typed by the event name.
const stopListening = lobbyListSession.on('message', messagePayload => {
  console.log(messagePayload)
})

stopListening()

message: LobbyListServerMessage

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

Every decoded server message, before per-type dispatch.


pong ​

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()

// Listener payloads are typed by the event name.
const stopListening = lobbyListSession.on('pong', pongPayload => {
  console.log(pongPayload)
})

stopListening()

pong: PongPayload

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

Keepalive replies to LobbyListSession.ping.


snapshot ​

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()

// Listener payloads are typed by the event name.
const stopListening = lobbyListSession.on('snapshot', snapshotPayload => {
  console.log(snapshotPayload)
})

stopListening()

snapshot: LobbyListResponse

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

The latest complete, authoritative public lobby list.

Released under the MIT License.