Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Web, API & dataSeniorOccasionalTroubleshooting

What should a QA engineer verify around WebSocket Ping/Pong, close codes and reconnect behavior?

Answer

Ping/Pong control frames or an application heartbeat are used to detect dead or idle peers, but the exact heartbeat and reconnect policy is application-specific. Test the expected heartbeat interval, missing responses, slow networks, proxy idle timeouts and cleanup of dead sockets. Recognize common close codes such as 1000 normal closure, 1001 going away, 1002 protocol error, 1008 policy violation, 1009 message too big and 1011 unexpected server condition. Reconnect should use bounded backoff and usually jitter, restore required authentication/subscriptions, avoid duplicate live sockets and define how missed or in-flight messages are handled.

Strong answer includes

  • heartbeat detects dead/idle peers
  • recognizes important close codes
  • reconnect backoff, resubscription and duplicate prevention

Practical example

A reverse proxy closes idle sockets after 60 seconds while the application sends a heartbeat every 90 seconds. Users see periodic disconnects even though the backend is healthy. The test should expose the timeout mismatch and verify the corrected heartbeat/reconnect behavior.

#websocket#heartbeat#close-codes#reconnect

Sources

MDN HTTP referenceMozilla · HTTP methods, messages, status codes, headers, cookies and cachingAsyncAPI Specification 3.0.0AsyncAPI Initiative · Message-driven API channels, operations, messages, schemas and bindings