I have an app under Laravel
that uses Pusher
for real-time notification. My problem is, I want to filter the recipient of the message. I only want the administrators who logged-in to receive or view the notification sent by Pusher. Other users that aren't admin must not receive the notification. How could I do that in Pusher?
Make the username of logged in administrators (or any other unique user ID) part of the channel name on both ends and then publish to that channel.
There is no way to send a message to a user other than to have a channel per user.And each Channel allows only one user. Therefore the update at one channel is for a user. If you have 10 administrators logged in, there is no other way but to have 10 channels.But, as channels are simply a routing mechanism there is no real overhead in having lots of channels.