Chat

View as Markdown

Access the Chat API Consumer. You can instantiate a Chat.Client to subscribe to Chat events. Please check Chat Events for the full list of events that a Chat.Client can subscribe to.

Example

The following example logs the messages sent to the “welcome” channel.

1import { Chat } from "@signalwire/realtime-api";
2
3const chatClient = new Chat.Client({
4 project: "<project-id>",
5 token: "<api-token>",
6});
7
8chatClient.on("message", (m) => console.log(m));
9
10await chatClient.subscribe("welcome");

Classes