UNPKG

ws-client-js

Version:

WebSocket browser client implementation with reconnect behavior.

70 lines (69 loc) 2.72 kB
export declare const STATUS: Readonly<{ CONNECTING: "connecting"; OPEN: "open"; CLOSED: "closed"; }>; export declare const CLOSE_EVENT_CODE: Readonly<{ /** * Normal closure, meaning that the purpose for which the connection was established has been fulfilled. */ NORMAL: 1000; /** * An endpoint is "going away", such as a server going down or a browser having navigated away from a page. */ GOING_AWAY: 1001; /** * An endpoint is terminating the connection due to a protocol error */ PROTOCOL_ERROR: 1002; /** * An endpoint is terminating the connection because it has received a type of data it cannot accept * (e.g., an endpoint that understands only text data MAY send this if it receives a binary message). */ UNSUPPORTED_DATA: 1003; /** * Reserved. The specific meaning might be defined in the future. */ RESERVED: 1004; /** * No status code was actually present. */ NO_STATUS_RESERVED: 1005; /** * The connection was closed abnormally, e.g., without sending or receiving a Close control frame */ ABNORMAL_CLOSURE_RESERVED: 1006; /** * An endpoint is terminating the connection because it has received data within a message that was not consistent * with the type of the message (e.g., non-UTF-8 [http://tools.ietf.org/html/rfc3629] data within a text message). */ INVALID_FRAME_PAYLOAD_DATA: 1007; /** * An endpoint is terminating the connection because it has received a message that \"violates its policy\". * This reason is given either if there is no other sutible reason, or if there is a need to hide specific * details about the policy. */ POLICY_VIOLATION: 1008; /** * An endpoint is terminating the connection because it has received a message that is too big for it to process. */ MESSAGE_TOO_BIG: 1009; /** * An endpoint (client) is terminating the connection because it has expected the server to negotiate one * or more extension, but the server didn't return them in the response message of the WebSocket handshake. */ MISSING_EXTENSION: 1010; /** * A server is terminating the connection because it encountered an unexpected condition that prevented it * from fulfilling the request. */ INTERNAL_ERROR: 1011; SERVICE_RESTART: 1012; TRY_AGAIN_LATER: 1013; BAD_GATEWAY: 1014; /** * The connection was closed due to a failure to perform a TLS handshake * (e.g., the server certificate can't be verified) */ TLS_HANDSHAKE_RESERVED: 1015; }>;