Faustas Butkus
Faustas Butkus

Reputation: 311

Sending web push notifications from Laravel

I have a website running Laravel in the back-end, where users can create reports for other users.

When the report is created I would like to send a push notification to recipient user's desktop.

Do I need to use services like Pusher, OneSignal?

Any useful site with examples would be appreciated.

Upvotes: 5

Views: 17492

Answers (2)

Kenny Horna
Kenny Horna

Reputation: 14241

Your question

You could use Pusher, Redis/Socket.io, Pubnub, etc. Which one to use? well, this is more an opinion-based question.

These services broadcast events, then in your client apps (like your web front-end) you configure the client-side libraries of the service you choose to subscribe (to channels) and listen to those events.

The documentation explains it better.

Examples/tutorials

Pusher

This is a tutorial published by the Pusher team.

Redis/Socket.io

This one is a Laracasts series about this.

Just google.


Update

There is a Laravel-specific alternative, a package created exclusively for Laravel:

Laravel WebSockets

  • This is the post talking about the package and its inner working.
  • This is the repo.
  • Here you have the documentation.

Upvotes: 10

Tuhin Bepari
Tuhin Bepari

Reputation: 745

If you like to show Native Desktop notification then i would suggest Web Push notification. In this way once user subscribed to push notification ,they will get real time notification and does not need to be on your website. https://github.com/laravel-notification-channels/webpush

Upvotes: 0

Related Questions