- Docs
- Core Concepts
- Pub/Sub
Pub/Sub
Pub/sub is how QPub delivers real-time messages: publishers send to a channel, and every active subscriber on that channel receives the message.
Operations
| Operation | Socket | REST |
|---|---|---|
| Subscribe | Yes | No |
| Publish | Yes | Yes |
| Batch publish (many channels) | No | Yes |
Message shape (SDK callback)
interface Message {
action: number;
id?: string;
timestamp?: string;
channel: string;
alias?: string;
event?: string;
data?: unknown;
error?: { /* ... */ };
}
Common patterns
- Fan-out — one publisher, many subscribers on the same channel
- Server push — REST publish from your backend, Socket subscribe in clients
- Event-named messages — set
eventon publish; filter in the SDK on subscribe
Previous
Channel Lifecycle
Next
Publish