Contact Us 1-800-596-4880

WebSocket Connection Limit Policy

Policy Name

WebSocket Connection Limit

Summary

Limits the number of simultaneous WebSocket connections that each API instance allows

Category

Quality of Service

First Omni Gateway version available

v1.13.0

Returned status codes

429 - Too many WebSocket connections

Summary

The WebSocket Connection Limit policy tracks the number of active WebSocket connections for a specific API instance. Omni Gateway identifies these requests by the Upgrade: websocket header and ignores standard HTTP traffic. The WebSocket connection limit is distributed across Omni replicas.

When a WebSocket upgrade request arrives, Omni Gateway increments the counter to reserve capacity before forwarding the handshake to the upstream service. If the upstream service doesn’t return a 101 Switching Protocols response, Omni Gateway releases the reservation. After a successful WebSocket connection closes, Omni Gateway decrements the counter.

If the counter reaches the maximumConnections limit, Omni Gateway rejects the upgrade request with a 429 error code.

Configuring Policy Parameters

Omni Gateway Local Mode

When you apply the policy via declarative configuration files, Refer to the following policy definition and table of parameters:

- policyRef:
    name: websocket-connection-limit-flex
  config:
    maximumConnections: <integer> // REQUIRED, minimum 1
Parameter Required Default Value Description

maximumConnections

Yes

100

Maximum number of simultaneous WebSocket connections allowed for the API instance. The value must be an integer of 1 or greater.

Resource Configuration Example

- policyRef:
    name: websocket-connection-limit-flex
  config:
    maximumConnections: 500

Managed Omni Gateway and Omni Gateway Connected Mode

When you apply the policy from the UI, the following parameters are displayed:

Field Description Default Required

Maximum Connections

Maximum number of simultaneous WebSocket connections allowed for the API instance.

100

Yes