UNPKG

@signalwire/js

Version:
46 lines 1.3 kB
import type { ChatContract, ConsumerContract, UserOptions, Chat as ChatNamespace } from '@signalwire/core'; export interface ClientApiEvents extends ChatNamespace.BaseChatApiEvents { } /** @ignore */ export interface ClientFullState extends Client { } export interface Client extends ChatContract, Omit<ConsumerContract<ClientApiEvents, ClientFullState>, 'subscribe'> { } /** @ignore */ export interface ClientOptions extends UserOptions { } /** * 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: '<your_chat_token>', // get this from the REST APIs * }) * * await chatClient.subscribe([ 'mychannel1', 'mychannel2' ]) * * chatClient.on('message', (message) => { * console.log("Received", message.content, * "on", message.channel, * "at", message.publishedAt) * }) * * await chatClient.publish({ * channel: 'mychannel1', * content: 'hello world' * }) * ``` * * ## Events * * Please see {@link ClientApiEvents} for the list of events emitted by a chat * Client object. */ export declare const Client: { new (chatOptions: ClientOptions): Client; }; //# sourceMappingURL=Client.d.ts.map