- Docs
- Core Concepts
- Connection
Connection
A connection is a WebSocket session to wss://socket.qpub.io/v1. Only the Socket client maintains one. The REST client is request/response and has no persistent connection.
Creating a connection
import { QPub } from "@qpub/sdk";
const socket = new QPub.Socket({
apiKey: process.env.QPUB_API_KEY,
// autoConnect: true (default)
});
Auth runs before the socket opens when autoAuthenticate is enabled (default).
What you get
After connect, the SDK emits connected with connection metadata (including connectionId). You can then subscribe to channels and publish.
Lifecycle
See Connection Lifecycle for events, reconnect, and ping.
Limits
Plans limit concurrent connections and connection rates. See Limits.
Previous
Permissions
Next
Connection Lifecycle