Sample config indent and channels-stats location

parent fe9201be
...@@ -39,7 +39,7 @@ h2(#basic-configuration). Basic Configuration ...@@ -39,7 +39,7 @@ h2(#basic-configuration). Basic Configuration
<pre> <pre>
<code> <code>
location /channels_stats { location /channels-stats {
# activate channels statistics mode for this location # activate channels statistics mode for this location
push_stream_channels_statistics; push_stream_channels_statistics;
...@@ -53,6 +53,7 @@ h2(#basic-configuration). Basic Configuration ...@@ -53,6 +53,7 @@ h2(#basic-configuration). Basic Configuration
# query string based channel id # query string based channel id
set $push_stream_channel_id $arg_id; set $push_stream_channel_id $arg_id;
push_stream_max_channel_id_length 200;
# message template # message template
push_stream_message_template "<script>p(~id~,'~channel~','~text~');</script>"; push_stream_message_template "<script>p(~id~,'~channel~','~text~');</script>";
# store messages in memory # store messages in memory
...@@ -62,6 +63,7 @@ h2(#basic-configuration). Basic Configuration ...@@ -62,6 +63,7 @@ h2(#basic-configuration). Basic Configuration
# message ttl # message ttl
push_stream_min_message_buffer_timeout 5m; push_stream_min_message_buffer_timeout 5m;
# Message size limit
# client_max_body_size MUST be equal to client_body_buffer_size or # client_max_body_size MUST be equal to client_body_buffer_size or
# you will be sorry. # you will be sorry.
client_max_body_size 32k; client_max_body_size 32k;
...@@ -74,6 +76,7 @@ h2(#basic-configuration). Basic Configuration ...@@ -74,6 +76,7 @@ h2(#basic-configuration). Basic Configuration
# positional channel path # positional channel path
set $push_stream_channels_path $1; set $push_stream_channels_path $1;
push_stream_max_channel_id_length 200;
# header to be sent when receiving new subscriber connection # header to be sent when receiving new subscriber connection
push_stream_header_template "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta http-equiv=\"Cache-Control\" content=\"no-store\">\r\n<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\r\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\r\n<meta http-equiv=\"Expires\" content=\"Thu, 1 Jan 1970 00:00:00 GMT\">\r\n<script type=\"text/javascript\">\r\nwindow.onError = null;\r\ndocument.domain = 'localhost';\r\nparent.PushStream.register(this);\r\n</script>\r\n</head>\r\n<body onload=\"try { parent.PushStream.reset(this) } catch (e) {}\">"; push_stream_header_template "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta http-equiv=\"Cache-Control\" content=\"no-store\">\r\n<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\r\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\r\n<meta http-equiv=\"Expires\" content=\"Thu, 1 Jan 1970 00:00:00 GMT\">\r\n<script type=\"text/javascript\">\r\nwindow.onError = null;\r\ndocument.domain = 'localhost';\r\nparent.PushStream.register(this);\r\n</script>\r\n</head>\r\n<body onload=\"try { parent.PushStream.reset(this) } catch (e) {}\">";
# message template # message template
...@@ -87,6 +90,9 @@ h2(#basic-configuration). Basic Configuration ...@@ -87,6 +90,9 @@ h2(#basic-configuration). Basic Configuration
push_stream_ping_message_interval 10s; push_stream_ping_message_interval 10s;
# connection ttl to enable recycle # connection ttl to enable recycle
push_stream_subscriber_connection_timeout 15m; push_stream_subscriber_connection_timeout 15m;
# broadcast
push_stream_broadcast_channel_prefix "broad_";
push_stream_broadcast_channel_max_qtd 3;
# solving some leakage problem with persistent connections in # solving some leakage problem with persistent connections in
# Nginx's chunked filter (ngx_http_chunked_filter_module.c) # Nginx's chunked filter (ngx_http_chunked_filter_module.c)
...@@ -112,13 +118,13 @@ one terminal and start playing http pubsub: ...@@ -112,13 +118,13 @@ one terminal and start playing http pubsub:
curl -s -v "http://localhost/pub?id=my_channel_1" curl -s -v "http://localhost/pub?id=my_channel_1"
# All Channels Stats summarized (json format) # All Channels Stats summarized (json format)
curl -s -v "http://localhost/channels_stats" curl -s -v "http://localhost/channels-stats"
# All Channels Stats detailed (json format) # All Channels Stats detailed (json format)
curl -s -v "http://localhost/channels_stats?id=ALL" curl -s -v "http://localhost/channels-stats?id=ALL"
# Channels Stats (json format) # Channels Stats (json format)
curl -s -v "http://localhost/channels_stats?id=my_channel_1" curl -s -v "http://localhost/channels-stats?id=my_channel_1"
</code> </code>
</pre> </pre>
...@@ -138,7 +144,7 @@ A string to uniquely identify a communication channel. Must be present on locati ...@@ -138,7 +144,7 @@ A string to uniquely identify a communication channel. Must be present on locati
<code> <code>
set $push_channel_id $arg_id; set $push_channel_id $arg_id;
#channel id is now the url query string parameter "id" #channel id is now the url query string parameter "id"
#(/pub?id=channel_id_string or /channels_stats?id=channel_id_string) #(/pub?id=channel_id_string or /channels-stats?id=channel_id_string)
</code> </code>
</pre> </pre>
...@@ -197,14 +203,14 @@ You can get statistics in the formats plain, xml, yaml and json. The default is ...@@ -197,14 +203,14 @@ You can get statistics in the formats plain, xml, yaml and json. The default is
<pre> <pre>
<code> <code>
location /channels_stats { location /channels-stats {
push_stream_channels_statistics; push_stream_channels_statistics;
set $push_stream_channel_id $arg_id; set $push_stream_channel_id $arg_id;
} }
# /channels_stats -> get statistics about all channels in a summarized way # /channels-stats -> get statistics about all channels in a summarized way
# /channels_stats?id=ALL -> get statistics about all channels in a detailed way # /channels-stats?id=ALL -> get statistics about all channels in a detailed way
# /channels_stats?id=channel_id -> get statistics about a channel # /channels-stats?id=channel_id -> get statistics about a channel
</code> </code>
</pre> </pre>
......
pid logs/nginx.pid; pid logs/nginx.pid;
error_log logs/nginx-main_error.log debug; error_log logs/nginx-main_error.log debug;
# Development Mode # Development Mode
master_process off; master_process off;
daemon off; daemon off;
...@@ -36,7 +37,7 @@ http { ...@@ -36,7 +37,7 @@ http {
listen 80; listen 80;
server_name localhost; server_name localhost;
location /channels_stats { location /channels-stats {
# activate channels statistics mode for this location # activate channels statistics mode for this location
push_stream_channels_statistics; push_stream_channels_statistics;
...@@ -50,17 +51,17 @@ http { ...@@ -50,17 +51,17 @@ http {
# query string based channel id # query string based channel id
set $push_stream_channel_id $arg_id; set $push_stream_channel_id $arg_id;
push_stream_max_channel_id_length 200;
# message template # message template
push_stream_message_template "<script>p(~id~,'~channel~','~text~');</script>"; push_stream_message_template "<script>p(~id~,'~channel~','~text~');</script>";
# store messages # store messages in memory
push_stream_store_messages on; push_stream_store_messages on;
# max messages to store in memory # max messages to store in memory
push_stream_max_message_buffer_length 20; push_stream_max_message_buffer_length 20;
# message ttl # message ttl
push_stream_min_message_buffer_timeout 5m; push_stream_min_message_buffer_timeout 5m;
push_stream_max_channel_id_length 200; # Message size limit
# client_max_body_size MUST be equal to client_body_buffer_size or # client_max_body_size MUST be equal to client_body_buffer_size or
# you will be sorry. # you will be sorry.
client_max_body_size 32k; client_max_body_size 32k;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment