1
這是我第一次使用推杆。我正在嘗試做一個測試應用程序Laravel 5.2和Pusher。Laravel推杆前端未收到數據
上面的教程之後我配置我的Laravel並順利拿到了「通道」,「事件」,並從推進調試控制檯「數據」。
問題: 當我試圖讓從JavaScript則面臨着一些問題,推送通知。
<script>
Pusher.log = function (msg) {
// console.log(msg);
};
var pusher = new Pusher("{{env("PUSHER_KEY")}}")
var channel = pusher.subscribe('test-channel');
channel.bind('test-event', function (data) {
// console.log(data);
});
</script>
1.
console.log(msg);***
投擲這樣的消息。
推:國家改變:初始化 - >連接
(index):10 Pusher : Connecting : {"transport":"ws","url":"ws://ws.pusherapp.com:80/app/78b26f324ef425bcd2ca?protocol=7&client=js&version=3.0.0&flash=false"}
(index):10 Pusher : Connecting : {"transport":"ws","url":"ws://ws.pusherapp.com:80/app/78b26f324ef425bcd2ca?protocol=7&client=js&version=3.0.0&flash=false"}
(index):1 WebSocket connection to 'ws://ws.pusherapp.com/app/78b26f324ef425bcd2ca?protocol=7&client=js&version=3.0.0&flash=false' failed: WebSocket is closed before the connection is established.
pusher.min.js:12 Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4000,"message":"App is encrypted (SSL only)"}}}b.warn @ pusher.min.js:12(anonymous function) @ pusher.min.js:12a.emit @ pusher.min.js:30(anonymous function) @ pusher.min.js:85b @ pusher.min.js:80s @ pusher.min.js:46l @ pusher.min.js:49(anonymous function) @ pusher.min.js:50(anonymous function) @ pusher.min.js:52c.finish @ pusher.min.js:77a.onClosed @ pusher.min.js:77a.emit @ pusher.min.js:30c.changeState @ pusher.min.js:59c.onClose @ pusher.min.js:58a.socket.onclose @ pusher.min.js:59
(index):10 Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4000,"message":"App is encrypted (SSL only)"}}}
(index):10 Pusher : Connecting : {"transport":"ws","url":"wss://ws.pusherapp.com:443/app/78b26f324ef425bcd2ca?protocol=7&client=js&version=3.0.0&flash=false"}
(index):10 Pusher : State changed : connecting -> connected
(index):10 Pusher : Event sent : {"event":"pusher:subscribe","data":{"channel":"test-channel"}}
(index):10 Pusher : Event recd : {"event":"pusher_internal:subscription_succeeded","data":{},"channel":"test-channel"}
(index):10 Pusher : No callbacks on test-channel for pusher:subscription_succeeded
2.
channel.bind('test-event', function (data) {
console.log(data);
});
投擲沒什麼。
謝謝。我已經解決了這個問題。但忘了在這裏重播。再次感謝。 –