Please be aware that you are viewing our bleeding edge unstable documentation. Unless you wanted to view the bleeding edge (and possibly unstable) documentation, we recommend you use our stable docs.

Go to Ably's stable canonical documentation »

I know what I'm doing, let me see the bleeding edge docs »

You are viewing our bleeding edge unstable documentation. We recommend you use our stable documentation »
Fork me on GitHub

Pub/Sub

Pub/Sub is shorthand for the Publish/Subscribe architectural pattern, which is a popular pattern used for realtime data delivery. This messaging pattern lets any number of publishers publish data, ideally to a data channel/topic, which could be subscribed to by any number of subscribers. The important thing to note about Pub/Sub is that publishers and subscribers are completely decoupled. In addition, once subscribed, the subscribers no longer have to poll the server or data provider to check if there’s any new data that they need to be aware of; instead, they will be notified of it as it becomes available.


Pub/Sub in Ably

For instance, consider a location tracking application. The subscriber will continue to receive updates in real time for as long as the connection remains connected, and the client is subscribed for updates.


Pub/Sub in Ably

As seen in the illustration above, you can implement Pub/Sub easily by using Ably as the intermediary realtime messaging platform. Your publishers and subscribers can attach to named channels and Ably is responsible for routing the right message to the right client in real time (typically within 60ms globally).

Read our Realtime Library documentation to learn how you can implement Pub/Sub in your applications. You can also jump into our Pub/Sub tutorial or check out a quick bit video to see it in action.


Back to top