GitHub

Source

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";

Properties

options?ChatOptions

Returns

{
send: (message: string) => Promise<import('livekit-client').ChatMessage>;
update: (message: string, originalMessageOrId: string | import('livekit-client').ChatMessage) => Promise<{
readonly message: string;
readonly editTimestamp: number;
readonly id: string;
readonly timestamp: number;
}>;
chatMessages: ReceivedChatMessage[];
isSending: boolean;
}