drop_idle_publisher

The `drop_idle_publisher` directive allows NGINX to disconnect idle publishers from the RTMP server after a specified timeout period.

Syntaxdrop_idle_publisher time_in_milliseconds;
Defaultnone
Context
Arguments1

Description

The drop_idle_publisher directive in the NGINX RTMP module is designed to manage RTMP publishing sessions efficiently, particularly by controlling publisher connection lifetimes. This directive takes a single parameter that specifies the time period in milliseconds during which a publisher must remain active; if there is no activity from the publisher during this specified duration, the connection will be terminated. This is crucial for freeing up server resources that could be tied up by inactive publishers, allowing for better scalability and resource management within streaming environments.

The behavior of this directive become particularly useful in scenarios where multiple clients are publishing streams, such as live broadcasts or event streams. By setting this directive, server administrators can ensure that any idle sessions do not linger indefinitely, thus optimizing the overall performance of the streaming service. Ideally, administrators should consider typical usage patterns of their broadcasters to set an appropriate timeout value based on the expected interactions with the RTMP server.

When configuring this directive, it is key to balance between terminating inactive streams too quickly, which could disrupt legitimate use, and leaving them open for too long, which could waste server resources. Effectively, this directive can help to maintain a cleaner and more efficient server environment for both publishers and subscribers by ensuring that the server's resources are used wisely and remaining responsive to active broadcasting needs.

Config Example

rtmp {
    server {
        listen 1935;

        application live {
            live on;
            drop_idle_publisher 60000;  # drop publishers after 60 seconds of inactivity
        }
    }
}

Ensure that the time value set does not disrupt valid broadcasting activity.

Monitor the effects of this directive closely to avoid dropping users who may have brief periods of inactivity.

This directive applies only to publisher connections; it does not affect subscriber connections.

← Back to all directives