We've just scratched the surface of what Pusher can do and focused on showing how they can help you build notifications, activity streams and chat. But what else can Pusher do and what else can you build? That's the whole point of this section!
Pusher provides a way of triggering the same event on multiple channels.
This can be useful in applications where your channel information architecture requires users to subscribe to unique channels, but where you still want those users to recieve the same events.
For example, if each user subscribes to their own authenticated notifications channel (e.g. private-username-notifications
). If a user called leggetter
and a user called olga
were interested in a notification, Pusher's Multi-Channel Publishing functionality let's you trigger the same event on the notifications channel for both of these users:
$channels = [
'private-leggetter-notifications',
'private-olga-notifications'
];
$pusher->trigger($channels, 'new-notifications', ['text' => '...']);
Pusher provides special channels called Presence channels that allow you to build live user lists such as the ones you see in many chat applications.
Presence channels require authentication. As part of that authentication process your authentication endpoint can also provide information about the current user that is then distributed to clients to allow you to add UI logic to show who is online. In addition, special pusher:member_added
and pusher:member_removed
events are triggered on presence channels to let you update your UI to show users coming online and going offline.
For more information see Presence channels and Authenticating Users.
As well as being able to trigger events via Pusher from the server via the HTTP API, authenticated users can also trigger events from the client on Private and Presence channels.
Take a look at the client events docs for more information.
The Pusher HTTP API also provides a way of querying for information on channels. This includes:
For more information see the querying application state docs.
When you use a hosted service, that service tends to know information about what's going on within parts application that isn't available to your application server. Pusher WebHooks provide a mechanism for your application server to receive HTTP POST
requests when certain events happen within your Pusher application:
For more information see the WebHooks docs.
That's all folks! Finally, you can head to a (list of resources)[./resources.md] related to everything we've covered in this workshop.