How PubNub works

As mentioned earlier, PubNub works over HTTP rather than TCP or UDP sockets. This means, the PubNub service is entirely interacted with via a web service. How does this work?

There are two URLs which form all interactions with PubNub. One is used for publishing. You request this URL and pass all information such as Publish key, Subscribe key, the channel to publish on, and the message to publish, and so on.

The other URL is used for subscribing. For the best latency, you make a request to this URL, and as soon as it returns something you make another request, and so on. Unlike most web requests, this URL has an especially long time out, and won't return anything until somebody else publishes a message on that channel. That means ...

Get Unity Multiplayer Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.