push_stream_longpolling_connection_ttl

Sets the Time-To-Live (TTL) for long polling connections in the NGINX Push Stream module.

Syntaxpush_stream_longpolling_connection_ttl time;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The push_stream_longpolling_connection_ttl directive configures the Time-To-Live (TTL) value for long-polling connections. This value determines how long a connection remains active when there is no new data being sent to the subscriber before it is closed. By tuning this TTL value, administrators can manage system resources effectively, controlling the maximum wait time for clients expecting updates over long polling. A high TTL might lead to unresponsive applications if the server does not close inactive connections promptly, while a low value could result in clients being disconnected before receiving updates.

The directive specifies a time period, which is defined in seconds. Essentially, if the server does not send any data during this TTL period, the connection will be terminated. This helps balance between performance (by keeping connections open for active subscribers) and resource management (by closing connections that are likely no longer needed). Properly configuring this value is crucial in environments with fluctuating user activity levels to maintain an optimal user experience without exhausting server resources.

Config Example

http {
    push_stream_longpolling_connection_ttl 30s;
}

Setting the TTL too low may result in premature disconnections for active clients.

If not properly configured, high TTL values can consume excessive server resources due to keeping many connections open. Excessive open connections may saturate server capacity.

← Back to all directives