useChat
The useChat
hook provides chat functionality for a LiveKit room. It returns a simple send
function to send chat messages and an array of chatMessages
to hold received messages. It also returns a update
function that allows you to implement message-edit functionality.
Import
import { useChat } from "@livekit/components-react";
Remarks
It is possible to pass configurations for custom message encoding and decoding and non-default topics on which to send the messages.
Properties
options?
ChatOptions
Returns
{send: (message: string) => Promise<import("@livekit/components-core").ChatMessage>;update: (message: string, messageId: string) => Promise<import("@livekit/components-core").ChatMessage>;chatMessages: ReceivedChatMessage[];isSending: boolean;}