@my-swu/simulator-client / MatchSessionState
Interface: MatchSessionState
Defined in: packages/ts-sdk/src/match-session/session-state.ts:205
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: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
console.log(matchSessionState)Example
import type { MatchSessionState } from '@my-swu/simulator-client'
const idleState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
history: [],
errorMessages: [],
}
console.log(idleState.connectionState)See
https://simulator-sdk.my-swu.com/guide/match-session
Properties
aiStatus?
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { aiStatus } = matchSessionState
console.log(aiStatus)
optionalaiStatus?:AiStatusPayload
Defined in: packages/ts-sdk/src/match-session/session-state.ts:207
Latest AI attachment/pause status announced by the server.
connectionState
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { connectionState } = matchSessionState
console.log(connectionState)connectionState:
ConnectionState
Defined in: packages/ts-sdk/src/match-session/session-state.ts:209
Current transport state.
errorMessages
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { errorMessages } = matchSessionState
console.log(errorMessages)errorMessages: readonly
string[]
Defined in: packages/ts-sdk/src/match-session/session-state.ts:217
Human-readable error summaries.
errors
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { errors } = matchSessionState
console.log(errors)errors: readonly
ErrorPayload[]
Defined in: packages/ts-sdk/src/match-session/session-state.ts:211
Recent engine or SDK errors.
events
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { events } = matchSessionState
console.log(events)events: readonly
GameEvent[]
Defined in: packages/ts-sdk/src/match-session/session-state.ts:213
Recent game events, trimmed to the configured history limit.
history
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { history } = matchSessionState
console.log(history)history: readonly
MatchHistoryFeedEntry[]
Defined in: packages/ts-sdk/src/match-session/session-state.ts:215
Recent match history entries supplied by the server.
matchId?
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { matchId } = matchSessionState
console.log(matchId)
optionalmatchId?:string
Defined in: packages/ts-sdk/src/match-session/session-state.ts:219
Public match id when one is known.
reconnectState?
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { reconnectState } = matchSessionState
console.log(reconnectState)
optionalreconnectState?:MatchSessionReconnectState
Defined in: packages/ts-sdk/src/match-session/session-state.ts:221
Automatic reconnect progress, when recovering from an abnormal close.
seat?
Example:
import type { MatchSessionState } from '@my-swu/simulator-client'
const matchSessionState: MatchSessionState = {
connectionState: 'idle',
errors: [],
events: [],
errorMessages: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { seat: controlledSeat } = matchSessionState
console.log(controlledSeat)
optionalseat?:Seat
Defined in: packages/ts-sdk/src/match-session/session-state.ts:225
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: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { snapshot: matchSnapshot } = matchSessionState
console.log(matchSnapshot)
optionalsnapshot?:GameState
Defined in: packages/ts-sdk/src/match-session/session-state.ts:223
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: [],
// Server-pushed match history, replayed into the session state.
history: [],
}
const { welcome } = matchSessionState
console.log(welcome)
optionalwelcome?:WelcomePayload
Defined in: packages/ts-sdk/src/match-session/session-state.ts:227
Latest welcome payload when the socket handshake has completed.
