SDKs

QPub’s official client library is @qpub/sdk for JavaScript and TypeScript (browsers, Node.js, Bun, and React). Use the API and Language controls to switch Socket vs REST and JavaScript vs React.

Install

npm install @qpub/sdk
# or
bun add @qpub/sdk
ImportUse
@qpub/sdkQPub.Socket, QPub.Rest, types
@qpub/sdk/reactReact providers and hooks
CDN UMDGlobal QPub in the browser

Quick example

Use the Socket client for realtime subscribe and publish:

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

const socket = new QPub.Socket({
  apiKey: process.env.QPUB_API_KEY,
});

socket.connection.on("connected", async () => {
  const ch = socket.channels.get("news");
  await ch.subscribe((msg) => console.log(msg.data));
});

Do not put a production API key secret in a public browser app. Use token auth instead.

Next steps

Other languages

Use the REST API and Socket Protocol directly. Official SDKs for other languages are not documented yet.