WebSocket Connection Timeouts and 15-Minute Limit

Last updated: March 24, 2026

WebSocket connections in sandboxes have a 15-minute idle timeout. If no data flows through the connection for 15 minutes, it will be closed and the sandbox will transition to standby.

What happens when the 15-minute limit is reached?

When a WebSocket connection reaches the 15-minute limit, the connection will drop automatically. Your client must implement reconnection logic.

Handling long-running connections

For processes that need to run longer than 15 minutes, you have several options:

Automatic reconnection

When your existing connection closes, your client can automatically reconnect. This reconnection is typically seamless and fast enough for most use cases.

Sandbox keep-alive

By default, sandboxes automatically switch to standby after a few seconds of inactivity to save resources. However, it is possible to adjust this behaviour and keep the sandbox running when you launch a process, even if there isn’t an active connection to it. This is typically used to keep a server running in the sandbox environment even when it is not serving requests. Refer to the sandbox keep-alive documentation for details.

Ping-pong

To prevent connections from timing out due to inactivity, you need to implement a ping-pong mechanism:

  • You must actively send data between client and server

  • Implement regular ping-pong messages to maintain the connection

For more information, refer to the standby control documentation.