One of our primary goals when building Pusher has always been simplicity. Part of this is about hiding complexity, and providing clear and simple APIs for developers to use.
However, under the covers there is a complex distributed system handling all the messages and events which occur inside Pusher.
Exposing complexity via simple mechanisms
As well as distributing messages, we’d like to make it simple for you to consume some of our internal events so that you can build more powerful apps with Pusher. Our initial implementation uses WebHooks, which are a fantastically simple and elegant way for servers to send each other notifications.
The first class of events which we’re exposing allows your servers to be notified when any channel becomes occupied or vacant. There are a number of ways that this can be useful:
- Reducing the number of messages you send us
- Performing tasks when users subscribe to channels
- Building custom presence solutions on your server
As an example of the former, Panda is a video encoding service that displays the realtime encoding status of a user’s videos via a lovely dashboard. They were making huge numbers of API calls to Pusher, notifying users who weren’t online of status updates to their encodings. By using WebHooks, they’ve cut down massively on their API traffic by only sending events when someone is subscribed.
Check out our example application
We’ve built a demo application, filtrand to further demonstrate how Webhooks can be used. This app starts searching the twitter streaming API for one or more terms whenever a user subscribes to the appropriate channel. We’ve published a blog post that goes into more detail.
Full details on the format of WebHooks and how to integrate them are available in our WebHook docs. We’ve aimed to make this feature incredibly easy to get up and running with, but get in touch if you run into any problems.
Please note that we’re not charging for Webhooks initially, but it’s likely that they will count towards your message quota in future.
Taking things further
We have many plans for extending the list of events we expose in future. As usual with new features, we’re keen to hear how people are using them, so please let us know what you think, and show us the cool things you build.