0π
In MessageSent event do this
public function broadcastOn()
{
Broadcast::routes(['middleware' => ['auth:api']]);
return new PrivateChannel('chat');
}
And in BroadcastServiceProvider add the following line:
Broadcast::routes(['middleware' => ['auth:api']]);
0π
I have solved this by putting the below code from bootstrap.js to app.js. So, in my app.js β
import Echo from 'laravel-echo';
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
forceTLS: true,
});
But I donβt know why the same code is not working in bootstrap.js
Source:stackexchange.com