Setting HTTP method in notifications

Until recently all notifications (on_play, on_publish etc) used POST method for passing arguments. Now GET method is also supported. To set that use the directive: notify_method get.

While GET has certain limitations concerning data size, that way of passing data has one big advantage. Such callbacks can be handled directly in nginx’s http{} section.

Here’s a simple example how to disable playing for remote clients.

http {
    server {
        listen       8080;
        server_name  localhost;

        location /on_play {
            if ($arg_pageUrl ~* localhost) {
                return 200;
            }
            return 500;
        }
}

rtmp {
    server {
        listen 1935;
        notify_method get;

        application myapp {
            live on;
            on_play http://localhost:8080/on_play;
        }
    }
}

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: