Sending web push notifications from Laravel

12,827

Your question

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

This 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 Laracast series about this.

Just google.


Update

Since a couple of months ago, there's another 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.
Share:
12,827
Faustas Butkus
Author by

Faustas Butkus

Updated on June 04, 2022

Comments

  • Faustas Butkus
    Faustas Butkus about 2 years

    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.

  • Faustas Butkus
    Faustas Butkus over 6 years
    Do these services works even when the browser is down?
  • Kenny Horna
    Kenny Horna over 6 years
    Your server will fire events, those events are received by the service who will breadcast the events, the clients that wil be listening to those events wil be notified.
  • ctf0
    ctf0 almost 6 years
    there is a difference between websockets "browser have to be opened" and web push "browser doesnt have to be opened"
  • Alexanderp
    Alexanderp over 5 years
    Try this Laravel package pushmix/laravel-web-notification. To push web notifications you will require to obtain user permission and store device token to push notifications to.