Network

WebSocket Close Code Reference

Reference for all RFC 6455 WebSocket close status codes with descriptions, sender context, and a close frame builder.

16 codes

1000Normal Closureboth

The connection completed its purpose successfully. Both endpoints agree to close.

RFC 6455 §7.4.1

1001Going Awayboth

An endpoint is "going away", such as a server going down or a browser having navigated away from a page.

RFC 6455 §7.4.1

1002Protocol Errorboth

An endpoint is terminating the connection due to a protocol error.

RFC 6455 §7.4.1

1003Unsupported Databoth

An endpoint received a type of data it cannot accept (e.g. a text-only endpoint received binary data).

RFC 6455 §7.4.1

1004Reservedinternal

Reserved. The specific meaning might be defined in the future.

RFC 6455 §7.4.1

1005No Status Receivedinternal

A reserved value and MUST NOT be set as a status code in a Close control frame. Used internally to indicate no status code was present.

RFC 6455 §7.4.1

1006Abnormal Closureinternal

A reserved value and MUST NOT be set in a Close frame. Used to indicate an abnormal closure (no close frame was sent).

RFC 6455 §7.4.1

1007Invalid Frame Payload Databoth

An endpoint received data within a message that was not consistent with the type of the message (e.g. non-UTF-8 data in a text message).

RFC 6455 §7.4.1

1008Policy Violationboth

An endpoint received a message that violates its policy. A generic status code when 1003 and 1009 are not suitable.

RFC 6455 §7.4.1

1009Message Too Bigboth

An endpoint received a message that is too large for it to process.

RFC 6455 §7.4.1

1010Mandatory Extensionclient

The client expected the server to negotiate one or more extension, but the server did not.

RFC 6455 §7.4.1

1011Internal Errorserver

The server encountered an unexpected condition that prevented it from fulfilling the request.

RFC 6455 §7.4.1

1012Service Restartserver

The server is restarting.

Draft extensions

1013Try Again Laterserver

The server is temporarily unable to handle the request due to a temporary overloading or maintenance of the server.

Draft extensions

1014Bad Gatewayserver

The server received an invalid response from an upstream server (like a 502 HTTP status code).

Draft extensions

1015TLS Handshakeinternal

Reserved. Indicates TLS handshake failure. MUST NOT be set in a Close frame by an endpoint.

RFC 6455 §7.4.1

Share

marduc812

2026