Subscribers count is showing as 0 in production using Web Sockets

63 views
Skip to first unread message

krishnaxv

unread,
Jan 19, 2016, 7:19:53 AM1/19/16
to nginxpushstream
Hi Wanden,

We are trying to send notifications in our production environment. We are using Web Sockets. But when we run
We are getting

{"channel": "RNuCFWJh1a", "published_messages": "1", "stored_messages": "1", "subscribers": "0"},
{"channel": "q4jNxLs3KM", "published_messages": "0", "stored_messages": "0", "subscribers": "0"},
{"channel": "LRxt4D8vOo", "published_messages": "0", "stored_messages": "0", "subscribers": "0"}

Please note that subscribers count is 0.

We are able to publish content to the channel but it is not showing any subscribers. In the browsers console, we are also getting request logs under Web Sockets. We also tried to check the error log & are getting "push stream module: client closed prematurely connection (11: Resource temporarily unavailable)".

In our development environment on my Ubuntu machine, the notifications are running fine without any errors.

We are using following configuration on our development/production environment.

pid         logs/nginx.pid;
error_log   logs
/nginx-main_error.log debug;


worker_processes    
2;


events
{
    worker_connections  
1024;
   
use                 epoll;
}




http
{
    postpone_output
1; # only postpone a single byte, default 1460 bytes
    access_log      logs
/nginx-http_access.log;


    push_stream_shared_memory_size                
512m;
    push_stream_max_channel_id_length            
200;
   
# max messages to store in memory
    push_stream_max_messages_stored_per_channel  
50;
   
# message ttl
    push_stream_message_ttl                      
1440m;
   
# ping frequency
    push_stream_ping_message_interval            
30s;
   
# connection ttl to enable recycle
    push_stream_subscriber_connection_ttl        
45m;
   
# connection ttl for long polling
    push_stream_longpolling_connection_ttl        
30s;
    push_stream_timeout_with_body                 off
;


   
# wildcard
    push_stream_wildcard_channel_prefix        
"broad_";
    push_stream_wildcard_channel_max_qtd        
3;


   
#push_stream_message_template                "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\", \"tag\":\"~tag~\", \"time\":\"~time~\", #\"eventid\":\"~event-id~\"}";


   
# subscriber may create channels on demand or only authorized (publisher) may do it?
    push_stream_authorized_channels_only        off
;


    push_stream_allowed_origins
"*";


    server
{
        listen
80 default_server;
        server_name localhost
;


        location
/pub {
           
# activate publisher (admin) mode for this location
            push_stream_publisher admin
;


           
# query string based channel id
            push_stream_channels_path               $arg_id
;


           
# store messages in memory
            push_stream_store_messages              on
;
       
}


        location
/channels-stats {
           
# activate channels statistics mode for this location
            push_stream_channels_statistics
;


           
# query string based channel id
            push_stream_channels_path               $arg_id
;
       
}


        location
/sub/(.*) {
           
# content-type
            default_type                                            
"application/json; charset=utf-8";
            push_stream_subscriber
;
           
# positional channel path
            push_stream_channels_path                   $1
;
       
}


        location
~ /ws/(.*) {
           
# activate websocket mode for this location
            push_stream_subscriber websocket
;


           
# positional channel path
            push_stream_channels_path                   $1
;


            push_stream_last_received_message_time      
"$arg_time";
            push_stream_last_received_message_tag      
"$arg_tag";


           
# message template
            push_stream_message_template                
"{\"id\":~id~,\"channel\":\"~channel~\",\"text\":~text~,\"tag\":\"~tag~\",\"time\":\"~time~\"}";


           
# ping frequency
            push_stream_ping_message_interval          
10s;
            push_stream_websocket_allow_publish         on
;
       
}
       
        location
/static/ {
           
alias /home/ubuntu/static/;
            include
/usr/local/nginx/conf/mime.types;
         
}




        location
/ {
           
#include proxy_params;
            proxy_pass http
://unix:/home/ubuntu/project/my_site/my_site.sock;
            proxy_set_header
Host            $host;
            proxy_set_header X
-Forwarded-For $remote_addr;
       
}


   
}
}

It will be great if you can please guide us to resolve this.

Thanks,
krishnaxv

Wandenberg Peixoto

unread,
Jan 19, 2016, 7:30:36 AM1/19/16
to nginxpu...@googlegroups.com
Hi Krishnaxv,

any specific reason to be using postpone_output as 1 ?
This will make connections very very slow, what can make your client disconnect before receive all bytes.

Try to change this before we dig investigating other things.

Regards,
Wandenberg

--
You received this message because you are subscribed to the Google Groups "nginxpushstream" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nginxpushstre...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

krishnaxv

unread,
Jan 19, 2016, 7:47:08 AM1/19/16
to nginxpushstream
Hey Wanden,

No. There is no specific reason for this.

We just tried to comment it & also tried to set the default value as 1460. But, subscribers count is still showing as 0. Can you please advise us what needs to be done with postpone_output?

Also, is there any other detail that needs to be changed in the configuration file to resolve this?

Thanks,
krishnaxv


On Tuesday, January 19, 2016 at 6:00:36 PM UTC+5:30, Wanden wrote:
Hi Krishnaxv,

any specific reason to be using postpone_output as 1 ?
This will make connections very very slow, what can make your client disconnect before receive aey Wandenll bytes.

krishnaxv

unread,
Jan 19, 2016, 9:10:53 AM1/19/16
to nginxpushstream
Hey Wanden,

I have figured out what postpone_output does & have now set it's value to 0 to disable postponing data transmission. It will be great if you can please guide me to resolve this issue of subscriber count.

Thanks,
krishnaxv

Wandenberg Peixoto

unread,
Jan 19, 2016, 9:23:50 AM1/19/16
to nginxpu...@googlegroups.com
Hi,

can you give me access to your server?
Because only looking to your configuration there isn't nothing to avoid it to works.

Have you checked if there is some firewall avoiding the access or a route problem? 

krishnaxv

unread,
Jan 19, 2016, 9:46:51 AM1/19/16
to nginxpushstream
Hey,

I would have happily given the server access to you if I was working on my personal project. But, I am bound by the rules & restrictions. Hope you understand.

I am using Nginx 1.9 on EC2 Ubuntu 14.04 instance (m3.medium) on AWS. Following are the details of my error log.

2016/01/19 14:31:44 [info] 4057#0: *19893 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/q4jNxLs3KM?_=1453213940773&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A05%3A50%20GMT&eventid= HTTP/1.1", host: "my-site.com"
2016/01/19 14:32:26 [info] 4057#0: *19895 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/LRxt4D8vOo?_=1453213983715&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A05%3A48%20GMT&eventid= HTTP/1.1", host: "www.my-site.com"
2016/01/19 14:32:36 [info] 4057#0: *19896 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/q4jNxLs3KM?_=1453213993296&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A02%3A46%20GMT&eventid= HTTP/1.1", host: "my-site.com"
2016/01/19 14:32:44 [info] 4057#0: *19897 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/q4jNxLs3KM?_=1453214001774&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A05%3A50%20GMT&eventid= HTTP/1.1", host: "my-site.com"
2016/01/19 14:33:26 [info] 4057#0: *19898 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/LRxt4D8vOo?_=1453214043966&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A05%3A48%20GMT&eventid= HTTP/1.1", host: "www.my-site.com"
2016/01/19 14:33:36 [info] 4057#0: *19899 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/q4jNxLs3KM?_=1453214053570&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A02%3A46%20GMT&eventid= HTTP/1.1", host: "my-site.com"
2016/01/19 14:33:45 [info] 4057#0: *19900 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/q4jNxLs3KM?_=1453214062773&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A05%3A50%20GMT&eventid= HTTP/1.1", host: "my-site.com"
2016/01/19 14:34:27 [info] 4057#0: *19901 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/LRxt4D8vOo?_=1453214104226&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A05%3A48%20GMT&eventid= HTTP/1.1", host: "www.my-site.com"
2016/01/19 14:34:37 [info] 4057#0: *19902 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/q4jNxLs3KM?_=1453214113853&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A02%3A46%20GMT&eventid= HTTP/1.1", host: "my-site.com"
2016/01/19 14:34:47 [info] 4057#0: *19903 push stream module: client closed prematurely connection (11: Resource temporarily unavailable), client: 111.93.185.242, server: localhost, request: "GET /ws/RNuCFWJh1a/q4jNxLs3KM?_=1453214123773&tag=0&time=Tue%2C%2019%20Jan%202016%2014%3A05%3A50%20GMT&eventid= HTTP/1.1", host: "my-site.com"

Please let me know if you need any more detail.

Thanks,
krishnaxv
Reply all
Reply to author
Forward
0 new messages