Closed clayrain closed 8 years ago
Sorry, I didn't understand your problem. Are you running the example chat application and it is not working? Try to use one of the examples that are on docs with simpler configurations/html before move to a more advanced scenario with rtmp and so on. I don't believe that 3G should change the behavior of your application.
Hi, not a newbie with the rest, only with this module.
I learned by setting the push_stream_ping_message_interval to 5 seconds the connection does not drop on a 3G network (at least the one I am using) on an iPhone. But it would be nice not to have to ping every 5 seconds only because of the 3G network issue. And maybe this isn't the real cure but only a happenstance patch.
In general it seems this issue is related to websockets on 3G, and not this module:
http://stackoverflow.com/questions/5557776/websockets-over-a-3g-connection
To reproduce, I have had installed a bare bones from the example, then on an iPhone, on a 3G network (not wifi), when focus is brought to the the nickname form then to the message field to type a message, the status of page goes to OFF LINE (red words).
I notice though the one of the live demo on the server, for the most part, does not have the same issue. Which brings up the following questions to try to understand how come the demo server works predictably on 3G?
The question is in two parts:
It could be a difference in servers if I would have to blindly start guessing at variables, but I like the scientific approach better than guess :)
Any insight would be greatly appreciated to understand what is different at http://www.nginxpushstream.com/chat.html vs what I have running.
Maybe it is the rtmp block and the rest of the stuff going on in the config file and my server with only 512MB memory that is causing an issue. Don't know. Hoping to get some more facts to further investigate.
Since by changing to 5 seconds yielded a positive result, want to understand better if this is the true solution or if other variables could be effecting the connection on 3G.
Let me know if there is anything I can write or provide to better clarify. Thank you very much for your insight..
Hi @clayrain
the live demo application set a push_stream_ping_message_interval of 10 seconds. It's possible that the mobile closes the connection if there is no traffic for optimizations issues, battery as example. Once you set the ping message will always have traffic. The configuration at live demo is something like this
push_stream_shared_memory_size 20M;
push_stream_max_messages_stored_per_channel 20;
push_stream_message_ttl 20m;
push_stream_authorized_channels_only off;
push_stream_ping_message_interval 10s;
push_stream_subscriber_connection_ttl 15m;
push_stream_longpolling_connection_ttl 30s;
push_stream_broadcast_channel_prefix "broad_";
push_stream_broadcast_channel_max_qtd 3;
push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\"}";
What I mean about using a simpler configuration is that the file at 'misc' folder has a lot of conditionals and extra configurations because I use it for development, and it must not be used on production as is.
To sum up, probably your issue can be solved in two ways, set the ping message interval like you did using a reasonable time, like 10 or 15 seconds, or use long polling while on 3G. But I don't know if you will have access to this information from the browser API.
Using Nginx version 1.9.9
Trying to figure out why the websocket example drops on 3G to "offline status" after trying to type in a field. Works fine on desktop. However, the example at http://www.nginxpushstream.com/chat.html does work consistently on the phone:
Could it be the nginx.conf file has a difference???????
This is my current config:
user www-data; worker_processes 1;
events { worker_connections 1024; }
http { include mime.types; default_type application/octet-stream;
location /channels-stats {
activate channels statistics mode for this location
}