dimanche 13 novembre 2016

Laravel Pusher Not Receiving Data at Front End

It is my First experience with Pusher. I am trying to make a test App Laravel 5.2 and Pusher.

(http://ift.tt/1QWpfwg)

Following above tutorial I configured my Laravel and successfully got the "Channel", "Event" and "Data" from pusher Debug Console.

Problem: When I am trying to get push notification from JavaScript then facing some issues.

<script>
            Pusher.log = function (msg) {
//                console.log(msg);
            };
            var pusher = new Pusher("")
            var channel = pusher.subscribe('test-channel');
            channel.bind('test-event', function (data) {
//                console.log(data);
            });
    </script>

1.

console.log(msg);*** Throwing such a message.

Pusher : State changed : initialized -> connecting

(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);
});

Throwing Nothing.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire