WebSocket 1010 Mandatory Extension vs 1013 Try Again Later
Both WebSocket 1010 (Mandatory Extension) and 1013 (Try Again Later) belong to the WebSocket Close Codes category. 1010 indicates that the client is terminating the connection because the server did not negotiate one or more expected extensions in the handshake response. Meanwhile, 1013 means that the server is terminating the connection due to a temporary condition, such as being overloaded. The client should reconnect after a back-off period.
คำอธิบาย
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.
คำอธิบาย
The server is terminating the connection due to a temporary condition, such as being overloaded. The client should reconnect after a back-off period.
เมื่อคุณพบเห็น
The server is temporarily overloaded or throttling connections. Unlike 1012, this does not indicate a restart — the server is running but cannot serve more clients right now.
วิธีแก้ไข
Reconnect using exponential backoff (start at 1 second, double each attempt). If persistent, investigate server capacity, scale horizontally, or reduce the number of concurrent connections.
ความแตกต่างหลัก
WebSocket 1010: The client is terminating the connection because the server did not negotiate one or more expected extensions in the handshake response.
WebSocket 1013: The server is terminating the connection due to a temporary condition, such as being overloaded. The client should reconnect after a back-off period.
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.
You encounter 1013 when the server is temporarily overloaded or throttling connections. Unlike 1012, this does not indicate a restart — the server is running but cannot serve more clients right now.
ควรใช้อันไหนเมื่อไร
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. For 1013 (Try Again Later): Reconnect using exponential backoff (start at 1 second, double each attempt). If persistent, investigate server capacity, scale horizontally, or reduce the number of concurrent connections.