The purpose of the connection has been fulfilled and the connection is no longer needed.
An endpoint is no longer available (such as when a server is no longer available or a browser has navigated away from a webpage).
A protocol error has occurred.
The endpoint cannot receive this type of data.
An empty close frame was received.
Note When code is set to 1005, the reason parameter must be an empty string. Setting code to 1005 will send an empty close frame.
Data within a message is not
consistent with the type of the message.
The message violates an endpoint's policy.
The message is too large to process.
A client endpoint expected the server to negotiate one or
more extensions, but the server didn't return them in the response
message of the WebSocket handshake. The list of extensions that
are needed should appear in the reason parameter.
Status codes in the range 0-999 are not used.
Status codes in the range 1000-2999 are reserved for definition by the WebSocket protocol.
Status codes in the range 3000-3999 are reserved for use by libraries, frameworks, and applications. These status codes are registered directly with IANA. The interpretation of these codes is undefined by the WebSocket protocol.
Status codes in the range 4000-4999 are reserved for private use and cannot be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol.