Console
Products
Markdown

Topics

Live, transient publish/subscribe over HTTP and WebSockets with wildcard patterns and scoped subscribe credentials.

Topics provide low-latency, in-memory publish/subscribe scoped to your organization. Messages are strictly transient and are never persisted to disk or a database.

#Publishing Messages

Publish raw bytes over HTTP through the control API, MCP, or a Worker/Sandbox topic binding:

bash
skopik publish_to_topic --topic chat/lobby --body '{"user":"ada","text":"hi"}'

#Subscribing Over WebSocket

Clients connect to the public Topics endpoint:

text
wss://topics.platform.skopik.com/v1/subscribe
  • Wildcard patterns: Use * to match one path segment (e.g. chat/*) or ** to match across segments (e.g. chat/**).
  • Browser clients without API keys: Mint a short-lived, pattern-scoped subscribe credential via POST /v1/topics/credentials (or through a Worker's Topic binding at POST $SKOPIK_BINDINGS_URL/topics/{binding}/credentials) with {"patterns": ["chat/lobby"], "ttl_seconds": 300}.
js
// Inside a Worker with a Topic binding "EVENTS": { "topic": "chat/**" }
const res = await fetch(`${process.env.SKOPIK_BINDINGS_URL}/topics/EVENTS/credentials`, {
  method: 'POST',
  headers: { 'mh-bindings': '1', 'content-type': 'application/json' },
  body: JSON.stringify({ patterns: ['chat/room-42'], ttl_seconds: 300 }),
})
const { token } = await res.json()