Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Live terminal, chat and replay

Use client.watch(publicId, streamId, handlers) from peepvibes-sdk after resolving a stream by public ID. It opens wss://peepvibes.live/ws/s/:publicId with subprotocol v1.alis, sends no terminal input, and returns {send, close}. Call close() when your player unmounts.

If you do not need a custom renderer, use the owner-hosted iframe player instead. The SDK transport alone does not render Kitty images or terminal cells.

Render the terminal

handlers.init(frame) is called at first join and after reconnect. Clear both terminal text and Kitty graphics state before feeding the snapshot bytes frame.termInit. Set the grid to frame.cols × frame.rows; the creator’s grid is authoritative. handlers.output(bytes) receives raw byte runs: feed them in order to a terminal emulator with a Kitty APC graphics scanner; do not decode graphics as visible text. handlers.resize(cols, rows) updates the creator’s grid. handlers.status reports connecting, live, reconnecting, ended or revoked; close code 4030 means access revoked. A privacy pause does not reveal hidden output.

One binary WebSocket message is one ALiS v1 frame. Magic is ALiS\x01; init 0x01 contains last ID, time, columns, rows (unsigned LEB128), a theme (format 0, 8 or 16; the latter formats contain format+2 RGB triples), then length-prefixed initial terminal bytes. Output 0x6f and resize 0x72 carry event ID, relative time and their payload. EOT is 0x04. Input 0x69, marker 0x6d and exit 0x78 are recognized but not rendered by viewers. The TypeScript module decodes these frames; do not try to send frames over the viewer socket.

On supported terminals, the current CLI queries the creator’s foreground, background, and ANSI palette before launching the child, so indexed colours in the initial snapshot match subsequent output. If the terminal does not answer all colour queries, the viewer falls back to its own palette.

Chat

client.chat.history(streamId, {limit: 50}) returns visible messages in chronological order. The watch() transport refreshes this bounded history every three seconds; ALiS does not push chat messages. Removals disappear from the next poll. To send, obtain the user’s individual credential (see authentication) and call client.chat.send(streamId, body, {clientId}) or watcher.send(body, clientId?); the client ID deduplicates retries. Channel slowModeSeconds tells your UI when to enable the next send, but server limits remain authoritative.

Replay

If terminal recording was enabled, call client.replay.discover(publicId) or request GET https://peepvibes.live/api/watch/:publicId/replay. A sealed, unexpired recording visible to that caller returns { "castUrl": "/api/watch/recordings/:id.cast" }; otherwise it returns 404. Pass its castUrl to client.replay.cast(castUrl) to receive an asciicast v3 body. Access is rechecked for each cast request, including after the source stream’s visibility changes. Do not use the LiveView replay page as an embeddable player.

Voice/video are not part of this public watch transport. No cross-origin signaling or media consent API is provided by the SDK.