Thursday, November 8, 2012

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;
}
}
}

No comments:

Post a Comment