FlockRoom
Per-room state and actions. Returned by FlockClient.joinRoom().
FlockRoom represents a single room. You get one back from client.joinRoom(). It holds the room's current cursor and presence state and lets you send updates and listen for changes.
If you're using React, you don't need to use FlockRoom directly — the hooks handle it for you. Use useRoom() to get the raw room instance if you need escape-hatch access.
State accessors
roomId
The room's identifier, as passed to joinRoom.
getCursors
Returns a snapshot of all other users' current cursor positions in the room.
getPresence
Returns a snapshot of all users currently present in the room (excluding yourself).
getMyPresence
Returns your own current presence metadata.
Actions
updateCursor
Sends a cursor position update. Throttled to the cursor.throttleMs configured in joinRoom (default 50ms, ~20 updates/sec). Position values should be in 0–1 normalized coordinates.
updatePresence
Merges a partial update into your presence metadata. Only the fields you provide are changed; others are untouched.
leave
Sends a clean leave message to the server and removes the room locally. Other users see you leave immediately rather than waiting for the TTL to expire.
Events
on
Subscribes to room events. Returns an unsubscribe function.
Available events:
off
Removes an event listener.