Live streams

Live streams

Two kinds of live data: streams your page feeds itself, and end-to-end encrypted relay streams.

Local and relay streams

KindUse it when
Local streamYour page already receives the data (your own WebSocket, MQTT over WebSocket, a device API). Push samples in; nothing leaves the browser.
Relay streamData comes from devices or programs elsewhere. They encrypt and publish to the Kymoscope relay; your users’ browsers decrypt.

How relay streams stay private

  1. The publisher encrypts with a key derived from the stream password its sender chose (or, in a project, the project’s key), with PBKDF2 (600,000 iterations) and a random salt. The password never leaves the publisher. See Who can watch a stream.
  2. Every batch of samples is encrypted with AES-256-GCM before it leaves the publisher.
  3. The relay forwards those bytes to viewers. It holds no key and cannot read or alter them.
  4. The viewer’s browser derives the same key from the stream password and decrypts (project members: from the project key, with nothing typed). A wrong password is detected before any data is shown.

Integrity

Every message is encrypted on its own, so on top of that about once a second the sender seals into the stream how many messages it sent since the last time and a hash of them, with the stream's id. The viewer checks each one: if a message went missing, came twice, came out of order or came from another stream on the way, connection.integrity.broken counts it and the app says so under the stream. Recordings made by the Python SDK and the collector carry the same check per chunk and say what didn't match when they are opened. Older viewers ignore it.

Performance

  • Each stream keeps up to 10 million samples, within an eighth of the computer's memory (2 GB on a 16 GB computer, and when the browser doesn't say; at least 512 MB), at 8 bytes per sample per channel, time included; past that, or past what the browser gives, the oldest are dropped. Set both for every stream, or per stream:
    TypeScript
    createEngine({ live: { capacity: 50_000_000, maxMemoryMB: 2048 } })
    engine.live.openLocal('Bench rig', { capacity: 2_000_000 })
    await engine.live.connect(stream, apiKey, { maxMemoryMB: 1024 })
  • A steady stream does not re-render your React app: multi-band charts draw it outside React.
  • A stream is marked stale after 4 seconds without data and live again when samples resume.