*** id: e70a9375-0dfd-4429-8837-0a31cab4d86e title: PubSub sidebar-title: Overview position: 0 slug: /node/reference/pubsub description: >- Access the PubSub API for publish-subscribe messaging patterns. Subscribe to channels, publish messages, and build real-time event-driven applications. max-toc-depth: 3 ---------------- [pubsub-client-1]: /docs/server-sdk/v3/node/reference/pubsub/client [pubsub-client]: /docs/server-sdk/v3/node/reference/pubsub/client/events Access the PubSub API Consumer. You can instantiate a [PubSub.Client][pubsub-client-1] to subscribe to PubSub events. Please check [PubSub Events][pubsub-client] for the full list of events that a [PubSub.Client][pubsub-client-1] can subscribe to. #### Example The following example logs the messages sent to the "welcome" channel. ```javascript import { PubSub } from "@signalwire/realtime-api"; const pubSubClient = new PubSub.Client({ project: "", token: "", }); pubSubClient.on("message", (m) => console.log(m)); await pubSubClient.subscribe("welcome"); ``` ## Classes The main PubSub client for publishing messages and subscribing to channels. Represents a message received on a PubSub channel with content and metadata.