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