толкатель подписывается на событие только иногда

#javascript #websocket

#javascript #websocket

Вопрос:

почему pusher работает случайным образом, иногда он может получать push, иногда нет…

он работает только тогда, когда отладчик подписался на показ

 Connection  1614.1447055    Origin: http://127.0.0.1:3000   06:23:34
Subscribed  1614.1447055    Channel: export 06:23:34
  

но когда отладчик показывает

 Connection  1624.1445840    Origin: http://127.0.0.1:3000
  

но нет подписки, она не работает.
Почему? Это тот же javascript.

и для его подписки требуется очень много времени, почему?

 <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 amp;amp; 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>
  

Комментарии:

1. я думаю, мне следует использовать pubnub…

Ответ №1:

ОК… я нашел причину, почему. Подключается pusher.connection.state; . Для подключения в chrome Linux требуется очень много времени….