2013-09-06 3 views
0

길게 실행 된 작업 결과가 전송되는 비공개 채널을 만들고 있습니다. 나는 내 브라우저의 콘솔에서 다음과 같은 한 :개인용 푸셔 채널의 이벤트는 페이지를 새로 고친 후에 만 ​​수신됩니까?

Pusher.trigger s_channel_name, "ninja", {"message" => "whatever"} 
: 나는이 같은 이벤트를 트리거하고있어 내 작업자 프로세스에서

$(document).ready(function() { 
     Pusher.host = 'ws-eu.pusher.com'; 
     Pusher.sockjs_host = 'sockjs-eu.pusher.com'; 

     pusher = new Pusher("#{ ENV["PUSHER_APP_KEY"] }", {cluster: "eu"}); 
     var channel = pusher.subscribe("private-user-channel-11"); 

     // Some useful debug msgs 
     pusher.connection.bind('connecting', function() { 
     clog("connecting to pusher"); 
     }); 
     pusher.connection.bind('connected', function() { 
     clog('Connected to Pusher!'); 
     }); 
     pusher.connection.bind('failed', function() { 
     clog('Connection to Pusher failed :('); 
     }); 
     channel.bind('subscription_error', function(status) { 
     clog('Pusher subscription_error'); 
     }); 

     channel.bind("ninja", function(e) { 
     console.log(e); 
     }); 
    }); 

:

Pusher : State changed : initialized -> connecting 
rt_cli...?body=1 (line 5) 
Pusher : Connecting : {"transport":"ws","url":"ws://ws-eu.pusher.com:80/app/xxxxxxxxxxxxx?protocol=6&client=js&version=2.1.2&flash=false"} 
rt_cli...?body=1 (line 5) 
Pusher : State changed : connecting -> connected 
rt_cli...?body=1 (line 5) 
POST http://localhost:3000/pusher/auth 

pusher.min.js (line 111) 
Connected to Pusher! 
common.js?body=1 (line 56) 
Pusher : Event sent : {"event":"pusher:subscribe","data":{"auth":"179bfeac81d16e6ae36f:81fa74052368dac232d70146d2f2d343f3d4ce5befc34bce43673a9e6ceaa38a","channel":"private-user-channel-11"}} 
rt_cli...?body=1 (line 5) 
Pusher : Event recd : {"event":"pusher_internal:subscription_succeeded","data":{},"channel":"private-user-channel-11"} 
rt_cli...?body=1 (line 5) 
Pusher : No callbacks on private-user-channel-11 for pusher:subscription_succeeded 

클라이언트 측 연결은 다음과 같습니다

문제는 내 페이지가로드되고 스크립트가 실행되지만 브라우저에서 메시지를받지 못한다는 것입니다. 그러나 페이지를 새로 고침하고 브라우저 콘솔에서 로그를 보존하면 메시지가 수신되는 것을 볼 수 있습니다. 또한 두 개의 서로 다른 브라우저에 로그인하여 두 페이지를 모두 열어두면 새로 고치지 않은 브라우저가 실시간으로 이벤트를 수신합니다. 이것은 내가 요청한 메시지를받는 사람이 메시지를 수신하지 못하게하는 브라우저를 트리거하는 브라우저가 개인 채널에 연결된 모든 사용자에게 브로드 캐스팅 할 수있는 방법일까요? 이벤트를 Rails 콘솔에서 수동으로 (브라우저를 새로 고침하지 않고도) 나타납니다.

EDIT : 브라우저가 페이지를로드하기 전에 작업자가 작업을 마치고 메시지가 손실 된 것 같습니다. 문제는 문제는 작업자가 페이지 완료로드하기 전에 메시지를 트리거이었다

+1

가치가 솔루션을 제출 할 수있다 자신의 질문에 대한 답변으로 대답을 표시합니다. 그런 식으로 여전히 열린 질문으로 보이지 않습니다. – leggetter

답변

1

. 다른 곳에 누워, 나는 이벤트에 반응 할 수 없었다.

+0

그럼 어떻게이 문제를 해결 했습니까? – ardochhigh

관련 문제