Mohamed Athif Mohamed Athif - 11 months ago 104
PHP Question

pusher gives no call back

I am trying to test a basic pusher trigger event that gives me a simple alert and a console log, but it wont work. The response is received from the pusher console debug but there are no alerts. I am using laravel 5.3 and its routes and a view for this. Below is my code. I have censored the sensitive information.

route file web.php

Route::get('/bridge', function() {


$options = array(
'cluster' => 'ap1',
'encrypted' => true
$pusher = new Pusher(
'key censored',
'secret censored',
'app id censore',

$data['message'] = 'hello world';
$pusher->trigger('test_channel', 'my_event', $data);

return view('pusher');

and view pusher.blade.php

<!DOCTYPE html>
<title>Pusher Test</title>
<script src=""></script>

// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;

var pusher = new Pusher('e5bbf707214a6223d044', {
cluster: 'ap1',
encrypted: true

var channel = pusher.subscribe('test_channel');
channel.bind('my_event', function(data) {

chrome console gives me the following logs.

Pusher : State changed : initialized -> connecting
Pusher : Connecting : {"transport":"ws","url":"wss:// key?protocol=7&client=js&version=3.2.2&flash=false"}
Pusher : State changed : connecting -> connected with new socket ID 5034.8700909
Pusher : Event sent : {"event":"pusher:subscribe","data":{"channel":"test_channel"}}
Pusher : Event recd : {"event":"pusher_internal:subscription_succeeded","data":{},"channel":"test_channel"}
Pusher : No callbacks on test_channel for pusher:subscription_succeeded

Answer Source

You created a binding for the my_event event. This error is complaining that you don't have a callback for the pusher:subscription_succeeded event. If you want to catch that and handle it, you need to create a binding.

channel.bind('pusher:subscription_succeeded', function(members) {
    alert('successfully subscribed!');