I'm making a Client - Server application and I need to send web push notifications.
I have a Laravel api as a backend with laravel echo server with the broadcaster socket.io and a Vue JS ans a Frontend app.
When I try to send the notification from laravel-echo I can see the socket server log. I'm connecting through socket.io and I'm not using pusher.
I have the correct connection because I can see my log, even I can see I'm in because in the console I see my log.
import Echo from "laravel-echo"
window.echo = new Echo({
broadcaster : 'socket.io',
host : url_server+"6001"
});
And I have this code in my Vue component:
window.echo.private("App.Entities.User.2")
.notification(notification => {
console.log("notification demo", notification)
});
And this is my log notification from laravel server:
[2017-08-09 16:57:02] local.INFO: Broadcasting
[Illuminate\Notifications\Events\BroadcastNotificationCreated] on channels
[private-App.Entities.User.2] with payload:
{
"title": "Hello from Laravel!",
"body": "Thank you for using our application.",
"action_url": "https:\/\/laravel.com",
"created": "2017-08-09T16:57:02-05:00",
"id": "b3e037ce-9f4e-43d0-a847-e8623f56412d",
"type": "App\\Notifications\\ReminderSeller",
"socket": null
}
i think its a config issue, make sure that the config is correct in config/broadcasting.php
'default' => env('BROADCAST_DRIVER', 'redis'),
or is set in .env file BROADCAST_DRIVER=redis
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.