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

OperationSocketREST
SubscribeYesNo
PublishYesYes
Batch publish (many channels)NoYes

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 event on publish; filter in the SDK on subscribe

Continue with Publish and Subscribe.