Logistics of setting up pusher

Logistics of setting up pusher

TGDesigns

Member
Local time
23:56
Joined
Nov 20, 2019
Messages
66

This might be a simple answer, im setting up pusher notifications in my laravel app, how do I go about splitting notifications for different users? Does each user have their own channel?

What would be the best way of doing that? Or im fully open to suggestions!

Cheers,
Tom

 

Gummibeer

Astroneer
Moderator
Local time
00:56
Joined
Oct 5, 2019
Messages
1,150
Pronouns
he/him

The documentation will answer your question. 😉
So yes, a private channel per user.

Notifications will broadcast on a private channel formatted using a {notifiable}.{id} convention. So, if you are sending a notification to a App\User instance with an ID of 1, the notification will be broadcast on the App.User.1 private channel.

 
Last edited:

TGDesigns

Member
Local time
23:56
Joined
Nov 20, 2019
Messages
66

Thanks for the super fast reply @Gummibeer and @tom I appreciate it! Sorry for spamming with help all the time haha

I actually have pusher setup I just wasn't sure what the standard was for communicating privately to each user but it seems I should just be reading more! My bad

 

TGDesigns

Member
Local time
23:56
Joined
Nov 20, 2019
Messages
66

Ok guys, ive read through the tutorial and followed it step by step I believe i've installed everything correctly im just a little stuck at the end, I obviously need to pass "pool" to the view but im a little confused at how I get pool in my controller in the first place. Am I missing something obvious? am I sleep deprived? Who knows!

 

Gummibeer

Astroneer
Moderator
Local time
00:56
Joined
Oct 5, 2019
Messages
1,150
Pronouns
he/him

Pool is a model in this tutorial - strange choice.
So let's say you want to notify a user if his order is shipped you would use order.10 and $order instead of pool.10 or $pool.
I would recommend the official Laravel broadcast, notification, echo documentation. It uses pusher by default so you should only have to change anything if you want to use something else. But at all most is wrapped away so you can always use the same public API.
The official docs also describe how the channel name is constructed by default and so on.

 
Top