Skip to content

Part 11 — realtime

The relay pokes; your existing socket layer delivers; the device pulls.

// server
onPoke: (evt) => {
for (const memberId of evt.memberIds) {
hub.send(memberId, { type: 'skm.poke', graphId: evt.graphIdFor(memberId) });
}
};
// device
socket.on('skm.poke', ({ graphId }) => void engine.poke(graphId));

poke is a no-op for a graph this device is not following, so it is safe to fan out.

Without a socket layer, engine.startAutoSync(15_000) is a perfectly good answer for most apps — writes push within pushDebounceMs regardless, so the interval only governs how fast you see other people’s work.