*** id: be712c6f-f777-4268-9fa2-44e4aa6c1751 title: Chat.Client sidebar-title: Client slug: /js/reference/chat/client max-toc-depth: 3 ---------------- You can use the Client object to build a messaging system into the browser. Example usage: ```js import { Chat } from "@signalwire/js"; const chatClient = new Chat.Client({ token: "", // get this from the REST APIs }); await chatClient.subscribe(["mychannel1", "mychannel2"]); chatClient.on("message", (message) => { // prettier-ignore console.log("Received", message.content, "on", message.channel, "at", message.publishedAt); }); await chatClient.publish({ channel: "mychannel1", content: "hello world", }); ``` ## Constructors ### constructor * **new Client**(`chatOptions`) Creates a new Chat client. #### Parameters Configuration options for the Chat client SignalWire Chat token that can be obtained from the [REST APIs](/docs/apis/chat/tokens/create-chat-token). #### Example ```js import { Chat } from "@signalwire/js"; const chatClient = new Chat.Client({ token: "", }); ``` *** ## Type Aliases ### PaginationCursor This is a utility object that aids in pagination. It is specifically used in conjunction with the [getMessages](/docs/browser-sdk/v3/js/reference/chat/client/get-messages) method. #### Properties This property signifies the cursor for the subsequent page. This property signifies the cursor for the preceding page.