Collaboration: co-editing, presence and comments

@prismbi/prismbi/collab lets several people edit the same report live. It also shows who is looking at what, and supports comments on visuals and data points. Bookmarks are shared too.

import { connectReport, broadcastChannelTransport } from '@prismbi/prismbi/collab';

const session = connectReport(studio.report, broadcastChannelTransport('sales-q3'), { user: 'Ana' });

Try it: run npm run dev, then open /studio.html?room=demo in two tabs (add &user=Ana to name yourself).

How it stays consistent #

Two people changing the same visual at the same moment resolve to one of the changes. Different visuals never conflict.

Transports #

TransportUse
broadcastChannelTransport(room)Tabs and windows of the same browser; no server
webSocketTransport(url)A JSON relay server that forwards each message to the other clients in the room
memoryHub().connect()Tests and in-page demos
Your own { send, subscribe, close? }WebRTC, Ably, Pusher, Liveblocks, Supabase Realtime…

A minimal WebSocket relay just rebroadcasts. With ws on Node:

wss.on('connection', (socket) => socket.on('message', (m) => wss.clients.forEach((c) => c !== socket && c.send(String(m)))));

Presence #

Comments #

session.addComment({ visualId: 'cols', text: 'Why is Bikes so high?' });
session.addComment({ visualId: 'cols', text: 'Check Q4', point: identity }); // on a data point
session.comments({ visualId: 'cols' });
session.resolveComment(id);
session.on('comments', render);

Options #

connectReport(report, transport, { user: 'Ana', color: '#2a78d6', ui: true, joinTimeoutMs: 400 });