API Reference - @liveblocks/zustand
@liveblocks/zustand
provides you with Zustand
bindings for our realtime collaboration APIs, built on top of WebSockets. Read
our getting started guides to learn more.
Middleware
The liveblocks
middleware lets you connect a Zustand state to Liveblocks
Presence and Storage features.
client
See different authentication methods in the createClient
method.
presenceMapping
Mapping used to synchronize a part of your Zustand state with one Liveblocks Room presence.
storageMapping
Mapping used to synchronize a part of your Zustand state with one Liveblocks room storage.
state.liveblocks
Liveblocks extra state attached by the liveblocks.
enterRoom
Enters a room and starts syncing it with your Zustand state.
roomId
: The room’s ID.
If this is the first time you’re entering the room, the room is initialized from
your local Zustand state (only for the keys mentioned in your storageMapping
configuration).
leaveRoom
Leaves the current room and stops syncing it with Zustand state.
room
The Room
currently synced to your Zustand state.
others
Other users in the room. Empty when no room is currently synced.
isStorageLoading
Whether or not the room storage is currently loading.
status
Gets the current WebSocket connection status of the room.
The possible value are: initial
, connecting
, connected
, reconnecting
, or
disconnected
.