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
46bab9e2
Commit
46bab9e2
authored
Jan 01, 2012
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor on websocket tests
parent
3dec8bd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
34 deletions
+35
-34
base_test_case.rb
test/base_test_case.rb
+11
-32
test_websocket.rb
test/test_websocket.rb
+24
-2
No files found.
test/base_test_case.rb
View file @
46bab9e2
...
...
@@ -149,7 +149,6 @@ module BaseTestCase
@min_message_buffer_timeout
=
'50m'
@ping_message_interval
=
'10s'
@store_messages
=
'on'
@websocket_allow_publish
=
nil
@subscriber_connection_timeout
=
nil
@longpolling_connection_timeout
=
nil
@memory_cleanup_timeout
=
'5m'
...
...
@@ -280,6 +279,17 @@ http {
# timeout for long polling connections
<%= "push_stream_longpolling_connection_ttl #{@longpolling_connection_ttl};" unless @longpolling_connection_ttl.nil? %>
# header to be sent when receiving new subscriber connection
<%= %{push_stream_header_template "#{@header_template}";} unless @header_template.nil? %>
# message template
<%= %{push_stream_message_template "#{@message_template}";} unless @message_template.nil? %>
# footer to be sent when finishing subscriber connection
<%= %{push_stream_footer_template "#{@footer_template}";} unless @footer_template.nil? %>
# subscriber may create channels on demand or only authorized
# (publisher) may do it?
<%= "push_stream_authorized_channels_only #{@authorized_channels_only};" unless @authorized_channels_only.nil? %>
<%= "push_stream_broadcast_channel_max_qtd #{@broadcast_channel_max_qtd};" unless @broadcast_channel_max_qtd.nil? %>
server {
listen <%=nginx_port%>;
server_name <%=nginx_host%>;
...
...
@@ -321,39 +331,8 @@ http {
# positional channel path
set $push_stream_channels_path $1;
# header to be sent when receiving new subscriber connection
<%= %{push_stream_header_template "#{@header_template}";} unless @header_template.nil? %>
# message template
<%= %{push_stream_message_template "#{@message_template}";} unless @message_template.nil? %>
# footer to be sent when finishing subscriber connection
<%= %{push_stream_footer_template "#{@footer_template}";} unless @footer_template.nil? %>
# content-type
<%= %{push_stream_content_type "#{@content_type}";} unless @content_type.nil? %>
# subscriber may create channels on demand or only authorized
# (publisher) may do it?
<%= "push_stream_authorized_channels_only #{@authorized_channels_only};" unless @authorized_channels_only.nil? %>
<%= "push_stream_broadcast_channel_max_qtd #{@broadcast_channel_max_qtd};" unless @broadcast_channel_max_qtd.nil? %>
}
location ~ /ws/(.*)? {
# activate websocket mode for this location
push_stream_websocket;
# positional channel path
set $push_stream_channels_path $1;
# store messages
<%= "push_stream_store_messages #{@store_messages};" unless @store_messages.nil? %>
# allow subscriber to publish
<%= "push_stream_websocket_allow_publish #{@websocket_allow_publish};" unless @websocket_allow_publish.nil? %>
# header to be sent when receiving new subscriber connection
<%= %{push_stream_header_template "#{@header_template}";} unless @header_template.nil? %>
# message template
<%= %{push_stream_message_template "#{@message_template}";} unless @message_template.nil? %>
# footer to be sent when finishing subscriber connection
<%= %{push_stream_footer_template "#{@footer_template}";} unless @footer_template.nil? %>
}
<%= @extra_location %>
...
...
test/test_websocket.rb
View file @
46bab9e2
...
...
@@ -7,7 +7,16 @@ class TestWebSocket < Test::Unit::TestCase
@header_template
=
nil
@message_template
=
nil
@footer_template
=
nil
@websocket_allow_publish
=
nil
@extra_location
=
%q{
location ~ /ws/(.*)? {
# activate websocket mode for this location
push_stream_websocket;
# positional channel path
set $push_stream_channels_path $1;
}
}
end
def
test_accepted_methods
...
...
@@ -279,7 +288,20 @@ class TestWebSocket < Test::Unit::TestCase
end
def
config_test_publish_message_same_stream
@websocket_allow_publish
=
'on'
@extra_location
=
%q{
location ~ /ws/(.*)? {
# activate websocket mode for this location
push_stream_websocket;
# positional channel path
set $push_stream_channels_path $1;
# allow subscriber to publish
push_stream_websocket_allow_publish on;
# store messages
push_stream_store_messages on;
}
}
@message_template
=
'{\"channel\":\"~channel~\", \"id\":\"~id~\", \"message\":\"~text~\"}'
end
...
...
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