Interface ChatRoomProviderProps

Props for the ChatRoomProvider component.

interface ChatRoomProviderProps {
    attach?: boolean;
    children?: ReactNode | ReactNode[];
    id: string;
    options: RoomOptions;
    release?: boolean;
}

Properties

attach?: boolean

Set to false to disable auto-attaching the room when component mounts and auto-detaching when it unmounts.

If set to false, you must manually attach and detach the room using room.attach() and room.detach() or the provided shortcut functions that useRoom provides. Setting this flag to false is useful in the case where you have more providers for the same room, and you need to control the attachment manually or by choosing which provider handles it.

true

children?: ReactNode | ReactNode[]

Children nodes.

id: string

The id of the room.

options: RoomOptions

The options to use when creating the room. A convenient default value is provided by RoomOptionsDefaults, but it must explicitly be set here.

RoomOptionsDefaults can also be used partially, for example:

<ChatRoomProvider id="room-id" options={{
presence: RoomOptionsDefaults.presence,
reactions: RoomOptionsDefaults.reactions,
}} />

NOTE: This value is not memoized by the provider. It must be memoized in your component to prevent re-renders of a parent component from causing the room to be recreated.

release?: boolean

Set to false to disable auto-releasing the room when component unmounts, to support multiple ChatRoomProviders for the same room.

If set to false, you must manually release the room using chatClient.rooms.release(id) or have another ChatRoomProvider for the same room and release set to true.

true