Laravel Broadcast Events To Nuxt JS Not Being Received
I've got a Laravel 8.x project set up as an API with JWT auth. I'm using the Laravel Websockets package, I've also got the Laravel Echo package for Nuxt JS installed along with Pus
Solution 1:
In your AgentStats Event file use
public function broadcastOn(){
return new Channel('agents');
}
instead of
public function broadcastOn()
{
return new PrivateChannel('agents');
}
Solution 2:
use ShouldBroadcastNow
instead of ShouldBroadcast
before
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class AgentStats implements ShouldBroadcast{...}
after
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
class AgentStats implements ShouldBroadcastNow{...}
here is a full example with websockets in SSR Nuxtjs with Laravel https://github.com/DengSihan/bootstrap
Post a Comment for "Laravel Broadcast Events To Nuxt JS Not Being Received"