Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
5704f7e8
Commit
5704f7e8
authored
May 18, 2011
by
Rogério Carvalho Schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sample config indent and channels-stats location
parent
fe9201be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
28 deletions
+35
-28
README.textile
README.textile
+19
-13
nginx.conf
misc/nginx.conf
+16
-15
No files found.
README.textile
View file @
5704f7e8
...
...
@@ -39,7 +39,7 @@ h2(#basic-configuration). Basic Configuration
<pre>
<code>
location /channels
_
stats {
location /channels
-
stats {
# activate channels statistics mode for this location
push_stream_channels_statistics;
...
...
@@ -53,6 +53,7 @@ h2(#basic-configuration). Basic Configuration
# query string based channel id
set $push_stream_channel_id $arg_id;
push_stream_max_channel_id_length 200;
# message template
push_stream_message_template "
<script>
p
(
~
id
~
,
'
~channel~
'
,
'
~text~
'
);
</script>
";
# store messages in memory
...
...
@@ -62,6 +63,7 @@ h2(#basic-configuration). Basic Configuration
# message ttl
push_stream_min_message_buffer_timeout 5m;
# Message size limit
# client_max_body_size MUST be equal to client_body_buffer_size or
# you will be sorry.
client_max_body_size 32k;
...
...
@@ -73,13 +75,14 @@ h2(#basic-configuration). Basic Configuration
push_stream_subscriber;
# 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
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
push_stream_message_template "
<script>
p
(
~
id
~
,
'
~channel~
'
,
'
~text~
'
);
</script>
";
push_stream_message_template
"
<script>
p
(
~
id
~
,
'
~channel~
'
,
'
~text~
'
);
</script>
";
# content-type
push_stream_content_type "text/html; charset=utf-8";
push_stream_content_type
"text/html; charset=utf-8";
# subscriber may create channels on demand or only authorized
# (publisher) may do it?
push_stream_authorized_channels_only off;
...
...
@@ -87,6 +90,9 @@ h2(#basic-configuration). Basic Configuration
push_stream_ping_message_interval 10s;
# connection ttl to enable recycle
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
# Nginx's chunked filter (ngx_http_chunked_filter_module.c)
...
...
@@ -112,13 +118,13 @@ one terminal and start playing http pubsub:
curl -s -v "http://localhost/pub?id=my_channel_1"
# 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)
curl -s -v "http://localhost/channels
_
stats?id=ALL"
curl -s -v "http://localhost/channels
-
stats?id=ALL"
# 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>
</pre>
...
...
@@ -138,7 +144,7 @@ A string to uniquely identify a communication channel. Must be present on locati
<code>
set $push_channel_id $arg_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>
</pre>
...
...
@@ -197,14 +203,14 @@ You can get statistics in the formats plain, xml, yaml and json. The default is
<pre>
<code>
location /channels
_
stats {
location /channels
-
stats {
push_stream_channels_statistics;
set $push_stream_channel_id $arg_id;
}
# /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=channel_id -> get statistics about a channel
# /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=channel_id -> get statistics about a channel
</code>
</pre>
...
...
misc/nginx.conf
View file @
5704f7e8
pid
logs/nginx
.pid
;
error_log
logs/nginx-main
_error.log
debug
;
pid
logs/nginx
.pid
;
error_log
logs/nginx-main
_error.log
debug
;
# Development Mode
master_process
off
;
daemon
off
;
worker_processes
2
;
master_process
off
;
daemon
off
;
worker_processes
2
;
events
{
worker_connections
1024
;
...
...
@@ -36,7 +37,7 @@ http {
listen
80
;
server_name
localhost
;
location
/channels
_
stats
{
location
/channels
-
stats
{
# activate channels statistics mode for this location
push_stream_channels_statistics
;
...
...
@@ -50,17 +51,17 @@ http {
# query string based channel id
set
$push_stream_channel_id
$arg_id
;
push_stream_max_channel_id_length
200
;
# message template
push_stream_message_template
"<script>p(~id~,'~channel~','~text~')
;
</script>"
;
# store messages
push_stream_store_messages
on
;
# store messages
in memory
push_stream_store_messages
on
;
# max messages to store in memory
push_stream_max_message_buffer_length
20
;
# message ttl
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
# you will be sorry.
client_max_body_size
32k
;
...
...
@@ -72,14 +73,14 @@ http {
push_stream_subscriber
;
# positional channel path
set
$push_stream_channels_path
$1
;
push_stream_max_channel_id_length
200
;
set
$push_stream_channels_path
$1
;
push_stream_max_channel_id_length
200
;
# 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
push_stream_message_template
"<script>p(~id~,'~channel~','~text~')
;
</script>"
;
push_stream_message_template
"<script>p(~id~,'~channel~','~text~')
;
</script>"
;
# content-type
push_stream_content_type
"text/html
;
charset=utf-8"
;
push_stream_content_type
"text/html
;
charset=utf-8"
;
# subscriber may create channels on demand or only authorized
# (publisher) may do it?
push_stream_authorized_channels_only
off
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment