A quick overview of the concepts used in Liveblocks Comments.
In Liveblocks Comments, everything revolves around threads. In each multiplayer room you can create a number of threads. Each individual thread contains a list of comments written by your users.
Threads can be retrieved by a React hook or on your server. Here’s an example of a thread object.
Threads can also store custom metadata, which is helpful for integrating them into your product.
Each comment is created by a user, referenced by their user ID, and is part of a thread. The first comment in a thread is displayed at the top.
Here’s an example of a single comment inside a thread object.
A comment’s body
is in a custom CommentBody
format, though you most likely
won’t need to use this, as we render it in React for you. We also provide a
number of functions that allow you to easily
convert a comment’s body into Markdown, HTML, or plain text,
which is especially helpful for creating email notifications.
Deleting a comment doesn’t remove the comment object from the thread, instead
the comment.body
property is removed, and a comment.deletedAt
property is
added, which contains the deletion time. This allows you to handle the deleted
comment in whichever way you see fit, for example you may like to create a
“message deleted” placeholder for the comment. Alternatively, the comment can be
hidden completely.
A thread is only deleted after all its comments have been deleted.
We use cookies to collect data to improve your experience on our site. Read our Privacy Policy to learn more.