PubSub
Access the PubSub API Consumer. You can instantiate a PubSub.Client to subscribe to PubSub events. Please check PubSub Events for the full list of events that a PubSub.Client can subscribe to.
Example
The following example logs the messages sent to the "welcome" channel.
import { PubSub } from "@signalwire/realtime-api";
const pubSubClient = new PubSub.Client({
project: "<project-id>",
token: "<api-token>",
});
pubSubClient.on("message", (m) => console.log(m));
await pubSubClient.subscribe("welcome");