why pusher works randomly , sometimes it can receive the push , sometimes it is not …
it is working only when the debugger show subscribed
Connection 1614.1447055 Origin: http://127.0.0.1:3000 06:23:34
Subscribed 1614.1447055 Channel: export 06:23:34
but when debugger show
Connection 1624.1445840 Origin: http://127.0.0.1:3000
but no subscribed , it is not working.
Why? It is the same javascript.
and it is taking really long for it to subscribe , why?
<head>
<title>Share Your Application</title>
<script src="http://js.pusherapp.com/1.9/pusher.min.js" type="text/javascript"></script>
<script type="text/javascript">
// Enable pusher logging - don't include this in production
Pusher.log = function(message) {
if (window.console && window.console.log) window.console.log(message);
};
// Flash fallback logging - don't include this in production
WEB_SOCKET_DEBUG = true;
var pusher = new Pusher('ba6867c72bd360e49f8c');
var channel = pusher.subscribe('export');
channel.bind("project-2.html", function(d) {
alertBox_Show("Export successful!","Thank you for exporting the site. Please check your download folder.");
window.location = d.link;
sessionStorage["is_export"] = true;
unlockScreen();
$("#ajax_loading_image").hide();
$( "#republish_confirmation" ).dialog( "close" );
});
channel.bind("project-2.iads", function(d) {
alertBox_Show("Export successful!","Thank you for exporting the site. Please check your download folder.");
window.location = d.link;
sessionStorage["is_export"] = true;
unlockScreen();
$("#ajax_loading_image").hide();
$( "#republish_confirmation" ).dialog( "close" );
});
channel.bind("my_event", function(d) {
alert(d);
});
</script>
</head>
Ok … i found the reason why. The pusher.connection.state; is connecting. It is taking really long time to connect in chrome linux ….