You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!DOCTYPEhtml><head><title>Pusher Test</title><scripttype="text/javascript"src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script><scriptsrc="http://js.pusher.com/1.12/pusher.min.js"type="text/javascript"></script><scripttype="text/javascript">
$(document).ready(function() {Pusher.activity_timeout=500;Pusher.pong_timeout=500;varstatus=function(st){$('#status').text(st);}// Enable pusher logging - don't include this in productionPusher.log=function(message){if(window.console&&window.console.log)window.console.log(message);};// Flash fallback logging - don't include this in productionWEB_SOCKET_DEBUG=true;Pusher.channel_auth_endpoint='/app_dev.php/pusher/auth/';varpusher=newPusher('MY_KEY',{encrypted: true});varchannel=pusher.subscribe('presence-test_channel');channel.bind('my_event',function(data){alert(data);});pusher.connection.bind('state_change',function(state){status(state.current)})pusher.connection.bind('state_change',function(state){status(state.current)})})</script></head><body>
Connection status: <strong><spanid="status">unloaded</span></strong></body></html>
When I run this code, in the debug console on pusher, everything is fine: the client connects and subscribes to the presence-channel. But if I unplug my ethernet / close my laptop's lid / turn off wifi, there is no disconnection message in the debug console, even after a few minutes. I tried setting Pusher.activity_timeout and Pusher.pong_timeout to very low values (500 as you can see) but it doesn't help.
In my browser's javascript console, I can see ping/pong messages being sent. When I cut the connection, it doesn't seem to bother the server that much. Even though my webpage now reads "unavailable" (I print the current status connection).
I'm using Chrome (last release), OSX ML, Pusher 1.12. Same bug appears with firefox (last release) and safari.
The text was updated successfully, but these errors were encountered:
This is because the netinfo, offline online class that is used to detect when Pusher thinks the connection is on and online uses the browser bases navigator online offline event system. This is not reliable and does not detect the connection. In order for you app to work smoothly you can build your own online offline solution. The best approach to use your existing xhttp requests in your app to do it for you. When a request fails make a reliable ping to your server if that fails your app is offline, or your server is. In both cases your app is classified offline. You then need a delay ping to retry your service at intervals 5s,10s,25s,60s to reconnect. At which point an connection event can be hooked into pusher so that it reconnects
We're not going to work on reliability of 1.x, since that was the focus of 2.x. Switching to 2.1 should be painless and will improve connectivity dramatically. I don't think this issue was related to netinfo, though there are other problems it causes. We'll be reviewing online/offline detection soon.
Hi,
I'm doing tests with this code:
When I run this code, in the debug console on pusher, everything is fine: the client connects and subscribes to the presence-channel. But if I unplug my ethernet / close my laptop's lid / turn off wifi, there is no disconnection message in the debug console, even after a few minutes. I tried setting Pusher.activity_timeout and Pusher.pong_timeout to very low values (500 as you can see) but it doesn't help.
In my browser's javascript console, I can see ping/pong messages being sent. When I cut the connection, it doesn't seem to bother the server that much. Even though my webpage now reads "unavailable" (I print the current status connection).
I'm using Chrome (last release), OSX ML, Pusher 1.12. Same bug appears with firefox (last release) and safari.
The text was updated successfully, but these errors were encountered: