Created
January 4, 2024 12:06
-
-
Save mike-clark-8192/0922ca6a7335e8a7c74e6ebb1f63aa58 to your computer and use it in GitHub Desktop.
WebSocket CloseEvent code to description mapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WSCloseCodeToDesc = { | |
"0-999": {"short":"Not used.","long":"Not used."}, | |
"1000": {"short":"Normal Closure","long":"The connection successfully completed the purpose for which it was created."}, | |
"1001": {"short":"Going Away","long":"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."}, | |
"1002": {"short":"Protocol error","long":"The endpoint is terminating the connection due to a protocol error."}, | |
"1003": {"short":"Unsupported Data","long":"The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)"}, | |
"1004": {"short":"Reserved","long":"Reserved. A meaning might be defined in the future."}, | |
"1005": {"short":"No Status Rcvd","long":"Reserved. Indicates that no status code was provided even though one was expected."}, | |
"1006": {"short":"Abnormal Closure","long":"Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."}, | |
"1007": {"short":"Invalid frame payload data","long":"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."}, | |
"1008": {"short":"Policy Violation","long":"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."}, | |
"1009": {"short":"Message Too Big","long":"The endpoint is terminating the connection because a data frame was received that is too large."}, | |
"1010": {"short":"Mandatory Ext.","long":"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."}, | |
"1011": {"short":"Internal Error","long":"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."}, | |
"1012": {"short":"Service Restart","long":"The server is terminating the connection because it is restarting."}, | |
"1013": {"short":"Try Again Later","long":"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."}, | |
"1014": {"short":"Bad Gateway","long":"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."}, | |
"1015": {"short":"TLS handshake","long":"Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."}, | |
"1016-2999": {"short":"WebSocket Reserved","long":"For definition by future revisions of the WebSocket Protocol specification, and for definition by extension specifications."}, | |
"3000-3999": {"short":"IANA Reserved","long":"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."}, | |
"4000-4999": {"short":"Private Use","long":"For private use, and thus can't be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol."} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment