Matkey Matkey - 2 years ago 91
PHP Question

Pusher not receiving events from Laravel 5.2 broadcasting

I am using Laravel 5.2 and php 7. I am testing this on a local Mac OSX environment. I am having no trouble pinging other services or making requests with php. I configured my application by editing broadcasting.php and .env with my api details.


'default' => env('BROADCAST_DRIVER', 'pusher'),

'connections' => [

'pusher' => [
'driver' => 'pusher',
'key' => env('mykey'),
'secret' => env('mysecret'),
'app_id' => env('myappid'),

and in .env



I created a TestEvent like so


namespace App\Events;

use App\Events\Event;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class TestEvent extends Event implements ShouldBroadcast
use SerializesModels;

public $data;

public function __construct()
$this->data = array(
'power'=> '10'

public function broadcastOn()
return ['test_channel'];

I then call on the event like so

Event::fire(new TestEvent());

The event shows up and is processed in redis

[2016-02-04 10:06:18] Processed: Illuminate\Broadcasting\BroadcastEvent
[2016-02-04 10:08:44] Processed: Illuminate\Broadcasting\BroadcastEvent
[2016-02-04 10:11:14] Processed: Illuminate\Broadcasting\BroadcastEvent
[2016-02-04 10:11:59] Processed: Illuminate\Broadcasting\BroadcastEvent
[2016-02-04 10:14:22] Processed: Illuminate\Broadcasting\BroadcastEvent
[2016-02-04 11:17:04] Processed: Illuminate\Broadcasting\BroadcastEvent
[2016-02-04 11:38:14] Processed: Illuminate\Broadcasting\BroadcastEvent

But nothing shows up in pusher when viewing the debug console. So it seems that the event is never being sent to pusher for some reason. I also checked my timezone settings to make sure that was not an issue. There are no errors in my in the laravel log file when the event is broadcasted.

How can I solve this problem? Is there a good way to debug and see if there is actually a request being made to pusher?

Answer Source

This might not fix the issue and maybe you changed your details for the question, but if your .env is like this:


Shouldn't the code for your pusher credentials look like this:

'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_KEY'),
        'secret' => env('PUSHER_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),

It's referencing the value in your code, not the key!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download