@my-swu/simulator-client / LobbySessionEvents
Interface: LobbySessionEvents
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:373
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('change', changePayload => {
console.log(changePayload)
})
stopListening()Properties
change
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('change', changePayload => {
console.log(changePayload)
})
stopListening()change:
LobbySessionState
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:374
chatMessage
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('chatMessage', chatMessagePayload => {
console.log(chatMessagePayload)
})
stopListening()chatMessage:
LobbyChatMessage
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:375
closed
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('closed', closedPayload => {
console.log(closedPayload)
})
stopListening()closed:
LobbyClosedPayload
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:377
The lobby closed; its credentials no longer work.
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('connectionState', connectionStatePayload => {
console.log(connectionStatePayload)
})
stopListening()connectionState:
ConnectionState
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:378
error
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('error', errorPayload => {
console.log(errorPayload)
})
stopListening()error:
ErrorPayload
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:379
kicked
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('kicked', kickedPayload => {
console.log(kickedPayload)
})
stopListening()kicked:
LobbyKickedPayload
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:380
matchmakingRelocated
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('matchmakingRelocated', matchmakingRelocatedPayload => {
console.log(matchmakingRelocatedPayload)
})
stopListening()matchmakingRelocated:
LobbyAccessResponse
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:381
message
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('message', messagePayload => {
console.log(messagePayload)
})
stopListening()message:
LobbyServerMessage
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:383
playerPresence
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('playerPresence', playerPresencePayload => {
console.log(playerPresencePayload)
})
stopListening()playerPresence:
RoomPlayerPresenceEvent
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:382
pong
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('pong', pongPayload => {
console.log(pongPayload)
})
stopListening()pong:
PongPayload
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:384
privateView
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('privateView', privateViewPayload => {
console.log(privateViewPayload)
})
stopListening()privateView:
LobbyPrivateView
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:386
Private view pushed for this participant; arrives before started.
snapshot
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('snapshot', snapshotPayload => {
console.log(snapshotPayload)
})
stopListening()snapshot:
LobbySnapshot
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:387
started
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('started', startedPayload => {
console.log(startedPayload)
})
stopListening()started:
undefined
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:388
welcome
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',
})
// Keep playerToken private; it authenticates this lobby player.
const lobbySession = simulatorClient.lobbies.createSession({
lobbyId: 'lobby_123',
playerToken: 'player_token_123',
})
// Listener payloads are typed by the event name.
const stopListening = lobbySession.on('welcome', welcomePayload => {
console.log(welcomePayload)
})
stopListening()welcome:
object
Defined in: packages/ts-sdk/src/resources/lobby-types.ts:389
lobbyId
lobbyId:
string
playerId
playerId:
string
