push_stream_max_subscribers_per_channel

Limits the maximum number of subscribers allowed per channel in the NGINX Push Stream module.

Syntaxpush_stream_max_subscribers_per_channel number;
Defaultnone
Contexthttp
Arguments1

Description

The push_stream_max_subscribers_per_channel directive sets a cap on the number of subscribers that can simultaneously listen to a specific channel in the NGINX Push Stream module. When the limit specified by this directive is reached, any further attempts by clients to subscribe to that channel will fail, unless existing subscriptions are removed. This functionality is particularly useful in high-traffic scenarios when administrators want to manage resource usage and prevent overloading the server with excessive simultaneous connections.

When configuring this directive, you define an integer value representing the maximum number of subscribers per channel. This limit applies to all channels within the server context where the directive is placed, offering flexibility in handling subscriber limits per channel in your push stream application. Ensuring that subscriber limits are set appropriately can help improve the server's performance and stability under load, as well as provide a method to enforce application logic around user connections to streaming data.

To effectively use this directive, it must be placed in the http block of the NGINX configuration file. If the number of subscribers exceeds the defined maximum, NGINX will reject new subscription requests gracefully with an appropriate HTTP response code, allowing the system to manage connections without crashing or exceeding resource thresholds.

Config Example

http {
    push_stream_max_subscribers_per_channel 100;
}

Setting this value too low may restrict legitimate subscribers from accessing the service, leading to a poor user experience.

If combined with channel buffering features, ensure you consider the implications of subscriber limits on your application's design.

← Back to all directives