@my-swu/simulator-client / SIMULATOR_REJECTION_CLOSE_CODE
Variable: SIMULATOR_REJECTION_CLOSE_CODE
constSIMULATOR_REJECTION_CLOSE_CODE:4000=4000
Defined in: packages/ts-sdk/src/internal/errors.ts:66
Close code the simulator server uses to refuse a socket after completing the WebSocket upgrade.
Browsers cannot read the HTTP status or body of a failed upgrade, so the server accepts user-relevant refusals (unknown match, dead token, full, maintenance, …) and closes immediately with this code; the close reason carries the engine error code (e.g. match_not_found) for classification.
Example:
ts
import { SIMULATOR_REJECTION_CLOSE_CODE, SimulatorSocketError } from '@my-swu/simulator-client'
// Browsers cannot read a failed upgrade's status, so the server accepts the
// socket and closes with this code plus the engine error code as its reason.
const socketError = new SimulatorSocketError(
'rejected',
'socket refused by the simulator server',
{ closeCode: SIMULATOR_REJECTION_CLOSE_CODE, reason: 'match_not_found' },
)
console.log(socketError.serverCode)