For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
ReferenceGuidesClick-to-Call
ReferenceGuidesClick-to-Call
  • Core
    • Overview
  • SignalWire Client
    • Overview
    • Notifications
    • Client
    • Utility functions
  • Video
    • Overview
    • LocalOverlay
    • RoomSession
    • RoomSessionDevice
    • RoomSessionPlayback
    • RoomSessionRecording
    • RoomSessionScreenShare
    • RoomSessionStream
    • RoomDevice
    • RoomScreenShare
  • Chat
    • Overview
    • Client
      • Events
    • ChatMember
    • ChatMemberEntity
    • ChatMessage
    • ChatMessageEntity
  • PubSub
    • Overview
    • Client
    • PubSubMessage
  • WebRTC
    • Overview
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Constructors
  • constructor
  • Type Aliases
  • PaginationCursor
Chat

Chat.Client

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

Events

Next
Built with

You can use the Client object to build a messaging system into the browser.

Example usage:

1import { Chat } from "@signalwire/js";
2
3const chatClient = new Chat.Client({
4 token: "<your_chat_token>", // get this from the REST APIs
5});
6
7await chatClient.subscribe(["mychannel1", "mychannel2"]);
8
9chatClient.on("message", (message) => {
10 // prettier-ignore
11 console.log("Received", message.content,
12 "on", message.channel,
13 "at", message.publishedAt);
14});
15
16await chatClient.publish({
17 channel: "mychannel1",
18 content: "hello world",
19});

Constructors

constructor

  • new Client(chatOptions)

Creates a new Chat client.

Parameters

chatOptions
objectRequired

Configuration options for the Chat client

chatOptions.token
stringRequired

SignalWire Chat token that can be obtained from the REST APIs.

Example

1import { Chat } from "@signalwire/js";
2
3const chatClient = new Chat.Client({
4 token: "<your_chat_token>",
5});

Type Aliases

PaginationCursor

This is a utility object that aids in pagination. It is specifically used in conjunction with the getMessages method.

Properties

after
string

This property signifies the cursor for the subsequent page.

before
string

This property signifies the cursor for the preceding page.