WebSocket

WebSocket 1012 Service Restart vs 1014 Bad Gateway

Both WebSocket 1012 (Service Restart) and 1014 (Bad Gateway) belong to the WebSocket Close Codes category. 1012 indicates that the server is terminating the connection because it is restarting. The client should reconnect after a brief delay. Meanwhile, 1014 means that the server acting as a gateway or proxy received an invalid response from an upstream server it accessed while attempting to fulfill the request.

Beschreibung

The server is terminating the connection because it is restarting. The client should reconnect after a brief delay.

Wann Sie es sehen

The server is performing a planned restart — for example, during a deployment or configuration reload. The connection will be available again shortly.

Wie man es behebt

Implement automatic reconnection with a short delay (1-5 seconds). This code signals that reconnecting is expected and should succeed once the server is back up.

Beschreibung

The server acting as a gateway or proxy received an invalid response from an upstream server it accessed while attempting to fulfill the request.

Wann Sie es sehen

A reverse proxy or API gateway tried to establish a WebSocket connection to a backend server but received an invalid or no response. The upstream server may be down or misconfigured.

Wie man es behebt

Check the health of the upstream/backend WebSocket server. Verify the proxy configuration routes WebSocket upgrade requests correctly and that the backend is listening on the expected port.

Wesentliche Unterschiede

1.

WebSocket 1012: The server is terminating the connection because it is restarting. The client should reconnect after a brief delay.

2.

WebSocket 1014: The server acting as a gateway or proxy received an invalid response from an upstream server it accessed while attempting to fulfill the request.

3.

You encounter 1012 when the server is performing a planned restart — for example, during a deployment or configuration reload. The connection will be available again shortly.

4.

You encounter 1014 when a reverse proxy or API gateway tried to establish a WebSocket connection to a backend server but received an invalid or no response. The upstream server may be down or misconfigured.

Wann welchen verwenden

For 1012 (Service Restart): Implement automatic reconnection with a short delay (1-5 seconds). This code signals that reconnecting is expected and should succeed once the server is back up. For 1014 (Bad Gateway): Check the health of the upstream/backend WebSocket server. Verify the proxy configuration routes WebSocket upgrade requests correctly and that the backend is listening on the expected port.

Mehr erfahren