Overview
The following flow is a simplified representation of the lifecycle of a WebSocket connection between a client and a server. It includes the initialization phase, the operation phase, and the shutdown phase.status/initialize must be the first request on a connection. Until it succeeds, only status/ping is answered; any
other method gets a 405 and the server closes the connection. An initialize after the connection is active gets the
same answer.
Initialization phase is the first step in establishing a WebSocket connection between a client and a server.
This phase is crucial for setting up the necessary parameters and ensuring that both parties are ready for
communication.
Upon successful initialization, server and client begin the operation phase, where they can exchange messages
bidrectionally. This phase allows for real-time communication and data transfer between the two parties.
Finally, the shutdown phase occurs when either the client or server decides to terminate the connection. Closing the
connection removes every listener it holds.
Keep-alive and limits
status/pinganswers{}in every phase, before and after initialization, and writes nothing.- API Gateway closes a connection that has been idle for 10 minutes, so a quiet client sends a ping at least that often.
- API Gateway closes every connection after 2 hours, whatever its traffic.
- After a close, the client reconnects, sends
status/initializeagain and re-adds its listeners, since they do not survive the connection. Resume covers catching up on what was missed.

