Websocket closure
How to handle "Ticket destroyed" type of events?
To keep a session between Arcware and the client browser alive, there is an established websocket connection. The websocket transport can close for various reasons, which can be intentional or unintential. Also Arcware has reasons to forcefully close the connection from server side. In case you need to catch websocket closure, e.g. to re-establish connection or to track the event for reporting or monitoring, here you will find the codes that will be provided:
// Assuming you have your PixelStreaming of ArcwareInit available
PixelStreaming.websocketOnCloseHandler.add((event: CloseEvent) => {
console.log(`WebSocket closed. CloseCode: ${event.code} Reason: ${event.reason}`);
});The WebSocket default close codes can be found here.
Below you'll find a list of close codes custom to Arcware:
export enum CloseCode {
UNAUTHORIZED = 4450,
UNAUTHORIZED_NO_BYPASS_REGISTERED = 4451,
/** Unauthorized DirectFlow attempt. */
UNAUTHORIZED_DF = 4452,
SUSPENDED = 4453,
TRIAL_LIMIT = 4460,
MAX_RUNTIME = 4461,
SESSION_NOT_FOUND = 4470,
UNKNOWN_PROJECT = 4471,
PROJECT_DISABLED = 4472,
STREAM_DELETED = 4473,
NO_STREAM_AVAILABLE = 4501,
NO_PACKAGENAME_PROVIDED = 4502,
STREAM_DISCONNECTED = 4503,
STREAM_KEY_ALREADY_CONNECTED = 4504,
CLIENT_OCCUPATION_LIMIT_REACHED = 4505,
CLIENT_AFK = 4506,
CLIENT_RECONNECTING = 4507,
CLIENT_NO_PONG = 4508,
CLIENT_DESTROYED = 4509,
CLIENT_WITHOUT_TICKET = 4510,
CLOSE_ABNORMAL_CUSTOM = 4606,
CLOSE_SHARE_NO_RESOURCES_LEFT = 4607,
CLOSE_SHARE_ERROR = 4608,
CLOSE_INTERNAL_SERVER_ERROR = 4666
}Last updated