WebSocket 1005 No Status Received vs 1010 Mandatory Extension
Both WebSocket 1005 (No Status Received) and 1010 (Mandatory Extension) belong to the WebSocket Close Codes category. 1005 indicates that a reserved value that indicates no status code was present in the Close frame. This code must not be set by an endpoint when sending a Close frame. Meanwhile, 1010 means that the client is terminating the connection because the server did not negotiate one or more expected extensions in the handshake response.
説明
A reserved value that indicates no status code was present in the Close frame. This code must not be set by an endpoint when sending a Close frame.
このコードが表示される場合
The peer closed the connection with a Close frame that contained no status code payload. Your WebSocket library surfaces 1005 as a sentinel to indicate the absence of a code.
解決方法
This is an internal indicator, not a wire protocol value. If you see it frequently, the remote peer may have a bug where it sends empty Close frames — check the peer's implementation.
説明
The client is terminating the connection because the server did not negotiate one or more expected extensions in the handshake response.
このコードが表示される場合
The client requested a required WebSocket extension (e.g., permessage-deflate compression) during the handshake, but the server did not include it in its response.
解決方法
Enable the required extension on the server, or update the client to make the extension optional. Check the Sec-WebSocket-Extensions header in the handshake response.
主な違い
WebSocket 1005: A reserved value that indicates no status code was present in the Close frame. This code must not be set by an endpoint when sending a Close frame.
WebSocket 1010: The client is terminating the connection because the server did not negotiate one or more expected extensions in the handshake response.
You encounter 1005 when the peer closed the connection with a Close frame that contained no status code payload. Your WebSocket library surfaces 1005 as a sentinel to indicate the absence of a code.
You encounter 1010 when the client requested a required WebSocket extension (e.g., permessage-deflate compression) during the handshake, but the server did not include it in its response.
どちらをいつ使うか
For 1005 (No Status Received): This is an internal indicator, not a wire protocol value. If you see it frequently, the remote peer may have a bug where it sends empty Close frames — check the peer's implementation. For 1010 (Mandatory Extension): Enable the required extension on the server, or update the client to make the extension optional. Check the Sec-WebSocket-Extensions header in the handshake response.