session_relay
The 'session_relay' directive is used to enable session relaying for RTMP streams in the NGINX RTMP module.
Description
The 'session_relay' directive allows the server to relay RTMP sessions to another RTMP endpoint seamlessly. This feature is particularly useful for complex streaming setups where content needs to be redistributed to different servers or applications dynamically. When the directive is enabled, any incoming stream on a specified application can be pushed to another specified destination (like a different server or application) in real-time. The primary argument for this directive typically includes the destination address, where the stream should be relayed, ensuring the session maintains continuity.
It’s essential to configure proper access controls and security measures, especially when relaying streams across network boundaries. The 'session_relay' can also interact with other directives related to stream publishing and playback, so it’s crucial to understand how this directive will function in conjunction with existing configurations, such as authorization and stream management settings. This enables more advanced streaming scenarios, including failover mechanisms and load balancing when distributing RTMP streams across multiple servers or services.
Config Example
rtmp {
server {
listen 1935;
application live {
live on;
session_relay rtmp://backup-server/live;
}
}
}Ensure that the destination URL is reachable from the NGINX server running the RTMP application.
Check firewall settings that may block RTMP traffic to the relay destination.
Verify that the relay URL is properly formatted and points to an active RTMP server.