rtmp_auto_push_reconnect

The 'rtmp_auto_push_reconnect' directive enables automatic reconnection attempts for RTMP stream pushing in case of connectivity disruptions.

Syntaxrtmp_auto_push_reconnect interval;
Defaultnone
Contextmain
Arguments1

Description

The rtmp_auto_push_reconnect directive is part of the NGINX RTMP module and is used within the context of the main configuration. When enabled, it allows the server to automatically attempt to reconnect to downstream RTMP servers when a connection is lost. This is particularly useful for applications that require high availability, as it minimizes downtime by automating the reconnection process.

The directive takes a single argument, which indicates the interval (in milliseconds) between each reconnection attempt. If the argument is set to a value, NGINX will keep trying to establish the RTMP push stream connection at the defined intervals until successful. Users should consider the implications of setting this directive too aggressively, such as overwhelming the downstream server with frequent connection attempts during prolonged outages.

To implement this directive effectively, ensure that proper error handling practices are in place on the downstream server, and consider monitoring your stream status to identify recurring issues that may require further investigation. Proper tuning of the reconnection interval can optimize performance while balancing the load on both servers involved.

Config Example

rtmp {
    server {
        listen 1935;

        application live {
            live on;
            rtmp_auto_push_reconnect 5000;  # Reconnect every 5 seconds
        }
    }
}

Setting the reconnect interval too low may lead to excessive load on the upstream server.

Failure to handle stream errors properly could lead to unnecessary reconnection attempts and resource exhaustion on the server.

← Back to all directives