How to use Liveblocks Presence with Redux
In this guide, we’ll be learning how to use Liveblocks Presence with Redux using
the APIs from the [
If you want to list all the people connected to the room, you can use
state.liveblocks.others to get an array of the other users in the room.
To create immersive multiplayer experiences, it’s helpful for each person in the room to share their real‑time state with other connected users. That real‑time state often corresponds to a cursor position or even the item a user has currently selected. We call this concept "Presence".
For instance, to share the cursor’s position in real‑time with others, we’re
going to add a new
presenceMapping option to our
enhancer to specify which
part of the state maps to the current user’s
Then you can dispatch an action like in any redux app and we will broadcast this cursor to everyone in the room.
Get people’s cursor positions with
liveblocks.others.map(user => user.presence?.cursor). It’s worth noting that a
user presence can be