Connections & protocols

WebSocket

WebSocket is a protocol for maintaining a persistent connection over which a client and server can both send messages, without starting a new HTTP request for every update.

Also found under: WebSockets, WS

How it works

A persistent connection suits frequent interactive updates such as chat, live counters and collaboration. Applications still need message formats, access rules and recovery behavior on top of the transport. A connected socket alone does not store messages or recover changes missed while a device was offline.

In a Pubb integration

Pubb clients subscribe through a WebSocket endpoint while trusted backends publish through HTTP. Use a client SDK or implement the documented subscription protocol with the browser's native WebSocket API.

Connect a client

A practical example

A browser connects to wss://ws.pubb.io/socket with its public app key, subscribes to notifications and handles incoming events until the view closes.