WebSocket 1001 Going Away vs 1015 TLS Handshake Failure
Both WebSocket 1001 (Going Away) and 1015 (TLS Handshake Failure) belong to the WebSocket Close Codes category. 1001 indicates that an endpoint is going away, such as a server shutting down or a browser navigating away from the page. The connection must be closed. Meanwhile, 1015 means that a reserved value indicating the connection was closed because the TLS handshake failed. This code must not be set by an endpoint in a Close frame.
Descripción
An endpoint is going away, such as a server shutting down or a browser navigating away from the page. The connection must be closed.
Cuándo lo verás
The server is shutting down for maintenance, or the user navigated away from the page or closed the browser tab while a WebSocket was open.
Cómo solucionarlo
Implement automatic reconnection logic with exponential backoff in your client. If the server is restarting, the client should retry after a short delay.
Descripción
A reserved value indicating the connection was closed because the TLS handshake failed. This code must not be set by an endpoint in a Close frame.
Cuándo lo verás
The wss:// (WebSocket Secure) connection failed during the TLS negotiation — commonly due to an expired certificate, untrusted CA, or TLS version mismatch.
Cómo solucionarlo
Verify the server's TLS certificate is valid and not expired. Ensure both client and server support compatible TLS versions (TLS 1.2+). Check that intermediate certificates are properly chained.
Diferencias clave
WebSocket 1001: An endpoint is going away, such as a server shutting down or a browser navigating away from the page. The connection must be closed.
WebSocket 1015: A reserved value indicating the connection was closed because the TLS handshake failed. This code must not be set by an endpoint in a Close frame.
You encounter 1001 when the server is shutting down for maintenance, or the user navigated away from the page or closed the browser tab while a WebSocket was open.
You encounter 1015 when the wss:// (WebSocket Secure) connection failed during the TLS negotiation — commonly due to an expired certificate, untrusted CA, or TLS version mismatch.
Cuándo usar cada uno
For 1001 (Going Away): Implement automatic reconnection logic with exponential backoff in your client. If the server is restarting, the client should retry after a short delay. For 1015 (TLS Handshake Failure): Verify the server's TLS certificate is valid and not expired. Ensure both client and server support compatible TLS versions (TLS 1.2+). Check that intermediate certificates are properly chained.