SDK

One client shape. Every official SDK.

Socket and REST share the same tree — connect, channels.get, publish or subscribe. Queues sit on REST. JavaScript, TypeScript, Go, and plain HTTP all follow it.

import { QPub } from "@qpub/sdk";

const socket = new QPub.Socket({ apiKey: "…" });
const ch = socket.channels.get("demo");
await ch.subscribe((msg) => console.log(msg.data));
await ch.publish({ text: "Hello" }, { event: "greeting" });

Socket + REST

Realtime subscribe and publish on channels; durable enqueue and worker flows on queues.

One pattern across languages

Constructors differ by stack. Channel and queue handles stay the same mental model — fewer surprises when services mix runtimes.

  • QPub.Socket / QPub.Rest or qpub.NewSocket / qpub.NewRest
  • channels.get(name) → publish; subscribe on Socket
  • queues.enqueue and workers on REST only

SDK overview →

ClientSocket or Rest
channels.get(name)publish · subscribe*
queues.*REST only

* subscribe is Socket-only

Drop in with an API key

Start with a project key from QPub Cloud. Configure REST and WebSocket hosts when you need custom endpoints — defaults point at QPub production.

  • No separate credentials per modality
  • Works in local dev and production
  • Test channels in Cloud console before shipping

Authentication →

Environment
- QPUB_REST_HOST=…
- QPUB_WS_HOST=…
+ QPUB_API_KEY=…

Configure hosts via SDK options or environment — one API key per project.

Get to your first message

Four steps — same path for channels; swap in queues when you need async work.

  1. 1

    Create a project

    Sign up in QPub Cloud and generate an API key for your environment.

  2. 2

    Install a client

    Add @qpub/sdk (npm, pnpm, yarn, or bun), go get the Go module, or call REST with curl.

  3. 3

    Open Socket or Rest

    Use Socket for subscribe and live publish; use Rest for server publish, tokens, and queues.

  4. 4

    Use channels or queues

    channels.get for live updates; rest.queues.enqueue when you need async work.

Frequently asked questions

Do I need both Socket and REST?
Use Socket where clients subscribe and publish in realtime. Use REST from backends, cron, or serverless to publish or enqueue without a long-lived connection.
Where are SDK versions published?
@qpub/sdk ships on npm (including the React subpath). The Go module is github.com/qpubio/qpub-go on pkg.go.dev, with release notes on GitHub for both qpub-js and qpub-go.
What if my language has no official SDK?
Call the REST API with any HTTP client (curl included). The Socket wire protocol is documented for custom clients.
Build with the QPub SDK
Free Tier Included