60b2f681ef1464b960e26ba783688067149e7e62
[e-mobility-charging-stations-simulator.git] / src / types / WebSocket.ts
1 export const WebSocketCloseEventStatusString: Record<WebSocketCloseEventStatusCode, string> = Object.freeze({
2 1000: 'Normal Closure',
3 1001: 'Going Away',
4 1002: 'Protocol Error',
5 1003: 'Unsupported Frame Data',
6 1004: 'Reserved',
7 1005: 'No Status Received',
8 1006: 'Abnormal Closure',
9 1007: 'Invalid Frame Payload Data',
10 1008: 'Policy Violation',
11 1009: 'Message Too Large',
12 1010: 'Missing Extension',
13 1011: 'Server Internal Error',
14 1012: 'Service Restart',
15 1013: 'Try Again Later',
16 1014: 'Bad Gateway',
17 1015: 'TLS Handshake'
18 });
19
20 export enum WebSocketCloseEventStatusCode {
21 CLOSE_NORMAL = 1000,
22 CLOSE_GOING_AWAY = 1001,
23 CLOSE_PROTOCOL_ERROR = 1002,
24 CLOSE_UNSUPPORTED = 1003,
25 CLOSE_RESERVED = 1004,
26 CLOSE_NO_STATUS = 1005,
27 CLOSE_ABNORMAL = 1006,
28 CLOSE_INVALID_PAYLOAD = 1007,
29 CLOSE_POLICY_VIOLATION = 1008,
30 CLOSE_TOO_LARGE = 1009,
31 CLOSE_MISSING_EXTENSION = 1010,
32 CLOSE_SERVER_INTERNAL_ERROR = 1011,
33 CLOSE_SERVICE_RESTART = 1012,
34 CLOSE_TRY_AGAIN_LATER = 1013,
35 CLOSE_BAD_GATEWAY = 1014,
36 CLOSE_TLS_HANDSHAKE = 1015
37 }
38
39 export interface WSError extends Error {
40 code?: string
41 }