neoighodaro / laravel-pusher-web-notifications

An example on how to use Laravel and Pusher to create a web notification system.
87 stars 128 forks source link

Event Action Messages not delivering. #5

Open hayjay opened 6 years ago

hayjay commented 6 years ago

When the /test route is been clicked the necessary navbar notification isn't popping up on the other browser tab. You may need to use laravel Echo to fix or npm to require pusher it self.

kodunmi commented 4 years ago

I got it working

in your .env file change from log BROADCAST_DRIVER=log

to pusher BROADCAST_DRIVER=pusher

add 'Pusher' => Pusher\Pusher::class, to your app config aliases

Add to MyEvent event

public function broadcastAs() { return '//name of your even goes here eg: my-event'; }

In the welcome.blade.php add the return of the broadcastAs method eg: my-event to the channel.bind method

channel.bind('my-event', function(data) {......

After this it should work

hayjay commented 4 years ago

Ok great thanks!

I will try it out!

yudium commented 4 years ago

I follow @kodunmi but still not working. Then I open config/broadcasting.php and change following setting 'default' => env('BROADCAST_DRIVER', 'null') to 'default' => "pusher"

and it's working.

It is like laravel didn't read my .env file.