This demo still mounts the full board, but the same client now exposes the shared runtime session needed for filtered or projected live views. Host applications do not need to reimplement SSE, client identity, notification reduction, or card chat subscribe or unsubscribe.
const client = BoardLiveCardsClient.createBoardRuntimeClient({
fetchServer,
boardPaths,
getServerOrigin,
});
await client.bootstrapBoard({
boardId: 'default',
rootElement: boardRoot,
});
const session = client.getRuntimeSession();
const alertsView = client.createDerivedRuntime({
includeCard: (model) => model.id.startsWith('alert-'),
});
alertsView.mountBoard({
rootElement: alertsRoot,
mode: 'board',
});
// shares SSE + chat session with the main board
const session = BoardLiveCardsClient.createBoardRuntimeSession({
fetchServer,
boardPaths,
getServerOrigin,
});
session.attachProvidedState({ boardId, payload });
await session.bootstrap({ boardId, skipInitBoard: true });
const view = BoardLiveCardsClient.createDerivedBoardRuntime({
session,
includeCard: (model) => model.id !== 'hidden-card',
});
const state = BoardLiveCardsClient.serverPayloadToBoardState(payload);
const nextState = BoardLiveCardsClient.applyBoardNotifications(
state,
notifications,
() => payload,
);
const leftPane = BoardLiveCardsClient.pickBoardState(nextState, ['card-a']);
const rightPane = BoardLiveCardsClient.subtractBoardState(nextState, ['card-a']);
const session = client.getRuntimeSession();
await session.subscribeCardChats(cardId);
await session.unsubscribeCardChats(cardId);
// same shared client id is reused automatically
console.log(session.getClientId());
// incoming notifications keep mounted chat UIs synchronized
Initializing board...