推送者有时只订阅事件



为什么推送器工作随机,有时能收到推送,有时不能…

只有当调试器显示已订阅

时才工作
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 && 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…我找到了原因。pusher.connection.state;是连接。在chrome linux中连接需要很长时间....

相关内容

  • 没有找到相关文章

最新更新