Skip to main content
Threads allow users to reply to a specific message in a focused side-conversation without cluttering the main message stream. Each top-level message can have replies, and the threadReplyCount field on the message shows how many replies exist.

How Threads Work

  • Any message can be the root of a thread (a parentMessageId of null).
  • Thread replies have parentMessageId set to the root message’s ID.
  • Threads are one level deep — replies cannot have their own threads.
  • The threadReplyCount on a root message is updated in real-time via the thread:reply_count socket event.

Using useMessageThread

useMessageThread is a convenience hook that combines message loading and sending for a specific message thread:
Replies are loaded in ascending order (oldest first) and loadMore fetches newer replies.

Live Updates

An open thread stays current without refetching:
  • New replies from anyone, including your own sends (shown optimistically, then confirmed), appear in the thread as they arrive.
  • Edits, deletions, moderator removals and reactions on a reply update it in place.
  • After a dropped connection comes back, the thread loads the replies sent while it was offline (see Missed Messages After a Reconnect).
Replies live only in their thread. The main message stream holds top-level messages, the same ones the server returns for it, and shows a thread through its parent’s threadReplyCount. See useMessageThread.

Using useLiveChatMessages Directly

For more control, use useLiveChatMessages with a parentMessageId to load thread replies:

Showing the Reply Count

The root message object includes a threadReplyCount field. Use it to render a “View thread” button:
threadReplyCount is kept in sync automatically by ChatProvider when a new reply is sent by any participant.