Feeds

Bring realtime multiplayer to your workflows and AI chats with Feeds. Connect any server and use Liveblocks APIs to update your application state with realtime UI updates, chat messages, comment responses, status updates, and more.

Creating a feed

Feeds are realtime message lists that update live in your React app, inside rooms. Before sending a message, make sure to set the FeedMessageData type in your config file, which represents the custom data attached to each message. Any JSON data can be defined—in this example, each message has a role and content, ideal for chat.

liveblocks.config.ts

It often makes sense to create feeds from your back end, and then render the results on the front end. Here’s how to create a feed and send a message to it in Node.js.

Creating a feed and sending a message

Rendering a feed’s messages

In React, you can render the list of messages in a feed using useFeedMessages. This list updates in realtime for all connected users.

Rendering a feed's messages

Paginating feed messages

By default, the last 20 messages are loaded. You can create a “Load more” button to load more feeds using properties returned from useFeedMessages.

Sending messages from React

You can also add new feed messages from the front end, for example in a chat application.

Feeds can be read and edited from React, JavaScript, Node.js, Python, with n8n nodes, and via REST API. API references.

List all feeds

With useFeeds you can list all feeds inside the current room, and switch between them.

Filtering feeds

You can set metadata on each feed itself, and filter them with useFeeds. To get started, first define the FeedMetadata type in your config file.

liveblocks.config.ts

Then, when creating a feed, you can set the metadata.

When listing feeds, you can filter them by metadata.

Paginating feeds

By default, the last 20 messages are loaded. You can create a “Load more” button to load more feeds using properties returned from useFeeds.

Chat

One way to use Feeds is to create a multiplayer chat interface in your application, using each feed message as a chat message.

Read the chat use case for details on implementing each part of the interface.