S
S
stdio962020-03-24 16:33:38
Notifications
stdio96, 2020-03-24 16:33:38

What is the best way to organize realtime notifications in Laravel Echo using Pusher?

Hello.

If a user closes an issue, everyone who subscribes to it should receive a notification about it.

What I tried to do:

  • Use a notification to the right channel (when the corresponding TaskCompletedEvent that implements the ShouldBroadcast interface fires) of the user who closed the task (if this is a user with id 1, then the notification will go to the App.User.1 channel). But in this case, I have to subscribe each user to all those to whom he is subscribed (after he enters the site).
  • Send a notification (using the method above), but already on the public channel and already on the Frontend, check by id who should receive it (but then, in theory, someone can change these settings on their side and receive notifications about all users (yes, in In this case, it is not so critical, but it is interesting for the future))
  • Instead of using broadcast on TaskCompletedEvent , call the toBroadcast method on TaskCompletedNotification , which is called on TaskCompletedEvent . In this case, n-notifications will be generated (where n is the number of users who follow the user who closed the task).


What is the best way to organize realtime notifications on the site? Which method would be the best? Because Pusher has a limit on the number of messages, their number is important. Well, in terms of performance (if it affects).

I hope I made it clear.

Thanks

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question