Skip to main content
Swytch Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Pub/Sub

Notify currently connected subscribers when something changes. Use one client connection to subscribe:

SUBSCRIBE product:changed

From another connection, publish:

PUBLISH product:changed 42

Cluster pub/sub routes notifications to interested subscribers. It does not retain a backlog for disconnected clients, and a publish reply is not proof that an application processed the message.

For cache invalidation, let a reconnecting application fetch current state again. For work requiring acknowledgement and recovery, use streams.

See the pub/sub command reference.