server {
listen 8080 default_server;
server_name localhost;
location /pub {
# activate publisher mode for this location, with admin support
push_stream_publisher admin;
# query string based channel id
push_stream_channels_path $arg_id;
# store messages in memory
push_stream_store_messages on;
# Message size limit
# client_max_body_size MUST be equal to client_body_buffer_size or
# you will be sorry.
client_max_body_size 1m;
client_body_buffer_size 1m;
}
location ~ /sub/(.*) {
# activate subscriber mode for this location
push_stream_subscriber;
# positional channel path
push_stream_channels_path $1;
if ($arg_tests = "on") {
push_stream_channels_path "test_$1";
}
# header to be sent when receiving new subscriber connection
push_stream_header_template "
\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
# message template
push_stream_message_template "p(~id~,'~channel~','~text~','~event-id~', '~time~', '~tag~');
";
# footer to be sent when finishing subscriber connection
push_stream_footer_template "";
# content-type
default_type "text/html; charset=utf-8";
if ($arg_qs = "on") {
push_stream_last_received_message_time "$arg_time";
push_stream_last_received_message_tag "$arg_tag";
push_stream_last_event_id "$arg_eventid";
}
}
location ~ /ev/(.*) {
# activate event source mode for this location
push_stream_subscriber eventsource;
# positional channel path
push_stream_channels_path $1;
if ($arg_tests = "on") {
push_stream_channels_path "test_$1";
}
if ($arg_qs = "on") {
push_stream_last_received_message_time "$arg_time";
push_stream_last_received_message_tag "$arg_tag";
push_stream_last_event_id "$arg_eventid";
}
}
location ~ /lp/(.*) {
# activate long-polling mode for this location
push_stream_subscriber long-polling;
# positional channel path
push_stream_channels_path $1;
if ($arg_tests = "on") {
push_stream_channels_path "test_$1";
}
if ($arg_qs = "on") {
push_stream_last_received_message_time "$arg_time";
push_stream_last_received_message_tag "$arg_tag";
push_stream_last_event_id "$arg_eventid";
}
}
location ~ /jsonp/(.*) {
# activate long-polling mode for this location
push_stream_subscriber long-polling;
push_stream_last_received_message_time "$arg_time";
push_stream_last_received_message_tag "$arg_tag";
push_stream_last_event_id "$arg_eventid";
# positional channel path
push_stream_channels_path $1;
if ($arg_tests = "on") {
push_stream_channels_path "test_$1";
}
}
location ~ /ws/(.*) {
# activate websocket mode for this location
push_stream_subscriber websocket;
# positional channel path
push_stream_channels_path $1;
if ($arg_tests = "on") {
push_stream_channels_path "test_$1";
}
# store messages in memory
push_stream_store_messages on;
push_stream_websocket_allow_publish on;
if ($arg_qs = "on") {
push_stream_last_received_message_time "$arg_time";
push_stream_last_received_message_tag "$arg_tag";
push_stream_last_event_id "$arg_eventid";
}
}
location / {
#if (!-f $request_filename) {
# proxy_pass "http://localhost:8888";
#}
}
}