I'm new to using laravel pusher I've followed the documentation and watch some tutorials on how to use it but somehow I cant get it work. I'm using laravel 5.6 on, php7.1 and nginx.
I've added all the pusher keys in my .env file already, below are some of my codes
.env
BROADCAST_DRIVER=pusher
web.php
use App\Events\TestEvent;
Route::get('/test', function() {
event( new TestEvent() );
});
broadcasting.php
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
],
],
TestEvent.php
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class TestEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $user;
public $message;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
$this->user = ['name' => 'Test User', 'email' => '[email protected]'];
$this->message = 'Hello world';
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new Channel('TestChannel');
}
}
When I tried to access the route /test on my app I expected that Pusher debug console logs anything but it doesn't, even Pusher error log.
Any help would be much appreciated. Thanks!!

use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;- tayyab_fareedclass TestEvent implements ShouldBroadcastNow- tayyab_fareedSyncdriver in production tough. The solution suggested by @tayyab_fareed is useful for debugging, but doing this will execute the broadcast on the main thread instead of using background processes (so it will slow your complete request down). Read this - Fjarlaegur