@my-swu/simulator-client / MatchSessionState
Interface: MatchSessionState
Defined in: packages/ts-sdk/src/match-session/session-state.ts:136
Public, token-free state snapshot for one match session.
This state can be stored in UI state managers because it intentionally omits the private seatToken.
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
console.log(matchSessionState)Example
import type { MatchSessionState } from '@my-swu/simulator-client'
const idleState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
console.log(idleState.connectionState)See
https://simulator-sdk.my-swu.com/guide/match-session
Properties
connectionState
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
const { connectionState } = matchSessionState
console.log(connectionState)connectionState:
ConnectionState
Defined in: packages/ts-sdk/src/match-session/session-state.ts:138
Current transport state.
errorMessages
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
const { errorMessages } = matchSessionState
console.log(errorMessages)errorMessages: readonly
string[]
Defined in: packages/ts-sdk/src/match-session/session-state.ts:144
Human-readable error summaries.
errors
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
const { errors } = matchSessionState
console.log(errors)errors: readonly
ErrorPayload[]
Defined in: packages/ts-sdk/src/match-session/session-state.ts:140
Recent engine or SDK errors.
events
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
const { events } = matchSessionState
console.log(events)events: readonly
GameEvent[]
Defined in: packages/ts-sdk/src/match-session/session-state.ts:142
Recent game events, trimmed to the configured history limit.
matchId?
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
const { matchId } = matchSessionState
console.log(matchId)
optionalmatchId?:string
Defined in: packages/ts-sdk/src/match-session/session-state.ts:146
Public match id when one is known.
seat?
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
const { seat: controlledSeat } = matchSessionState
console.log(controlledSeat)
optionalseat?:Seat
Defined in: packages/ts-sdk/src/match-session/session-state.ts:150
Seat controlled by this session when known.
snapshot?
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
const { snapshot: matchSnapshot } = matchSessionState
console.log(matchSnapshot)
optionalsnapshot?:GameState
Defined in: packages/ts-sdk/src/match-session/session-state.ts:148
Latest authoritative private snapshot for this seat.
welcome?
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
}
const { welcome } = matchSessionState
console.log(welcome)
optionalwelcome?:WelcomePayload
Defined in: packages/ts-sdk/src/match-session/session-state.ts:152
Latest welcome payload when the socket handshake has completed.
