// docs / websocket-obs

WebSocket & OBS

LiveAudio runs a local WebSocket server that broadcasts subtitle JSON in real time to the built-in OBS /overlay (7 live themes + anti-burst reconnection) or any HTML/WebSocket client on localhost.

Server details

ParameterValue
ProtocolWebSocket (ws://)
Host127.0.0.1 (localhost only)
Port8765 by default, configurable via ws_port. If it is busy, the server tries the next ports up to ws_port + 9 (8765–8774 by default).
Effective portAnnounced in the first frame of every connection (hello) and shown in the app as the WS: <port> pill.
Overlay URLhttp://127.0.0.1:<port>/overlay — the OBS Browser Source URL. ws://127.0.0.1:<port> is the WebSocket endpoint, not what you paste into OBS.
FormatJSON
AuthNone — loopback-only listener plus an Origin allowlist (see Security)

JSON payload schema

subtitle.json
{
  "id": "utt_42",
  "text": "Hello everyone, welcome to the stream",
  "style": "default",
  "created_at": 1760000000.0,
  "processed_at": 1760000001.3,
  "queue_delay": 0.2,
  "total_delay": 1.3,
  "latency": 1.1,
  "is_replay": false,
  "catchup_interval_sec": 0.0
}
FieldTypeDescription
idstringOpaque per-session phrase identifier, such as utt_42. It restarts on each run and is not monotonic.
textstringTranscribed text, after blacklist filtering.
stylestringVisual style: default, karaoke, neon, minimal, bold, rgb, typewriter.
created_atnumberTimestamp when the audio segment was created.
processed_atnumberTimestamp when transcription completed.
queue_delaynumberSeconds the audio waited before entering the ASR engine.
total_delaynumberTotal delay from audio capture to a ready subtitle.
latencynumberSeconds the ASR engine (Parakeet-TDT or Whisper) spent transcribing the segment.
is_replaybooleanWhether this is a backlog / catch-up subtitle.
catchup_interval_secnumberRecommended pacing between backlog items in auto mode.

The built-in OBS overlay consumes text, style, is_replay, catchup_interval_sec, theme frames and optional subtitle_partial frames. The remaining fields are metadata for diagnostics — useful if you build your own client, ignorable if you do not. Frames that carry a type field (hello, theme, subtitle_partial) are not captions.

Subtitle styles

The style field selects one of seven built-in looks, switchable from the Style tab, which also holds presets and a live preview (the Subtitles tab holds the display mode: adaptive, single or ribbon):

StyleLook
defaultWhite text on a semi-transparent black background, soft fade in/out.
karaokeWords appear staggered with a popIn animation; bright yellow with a black outline.
neonCyan glow, uppercase, wide letter-spacing.
minimalNo background, subtle fade — for streams with their own design.
boldHigh-contrast thick text, fast animation, strong on-screen presence.
rgbEach word takes a different rainbow color.
typewriterWords type in one at a time with a blinking cursor; monospaced.

OBS backlog policy

The backlog policy controls only what shows live in OBS. Everything valid is always saved to disk regardless of policy.

ModeConfig valueBehavior
AutoautoSends fresh subtitles plus a short, paced backlog. Drops anything past the max delay.
Live onlylive_onlySaves everything; shows only what is within subtitle_max_live_delay_sec.
Send allsend_allSends everything to OBS even when it arrives late.

Security

  • Loopback only — the server binds 127.0.0.1 and drops peers that are not loopback.
  • Origin rules — no Origin header (native apps, scripts) is accepted; several Origin headers get HTTP 403. http://absolute (OBS Browser Source), tauri.localhost, and loopback origins on the server's bound port (the /overlay page) or on an allowlisted port are accepted; anything else gets 403.
  • Allowlist — add the port of any other local browser tool in Advanced > Allowed local connections (default [1420]). The card also lists recent blocked attempts.
  • Limits — at most 64 simultaneous connections, inbound messages up to 64 KiB, and a 5 s handshake timeout.
  • No authentication — any local process that sends no Origin can read subtitles.
  • Broadcast — multiple clients receive the same messages simultaneously.

OBS Browser Source setup

  • In OBS, Sources → + → Browser.
  • Start the system, then copy the overlay URL from LiveAudio (Copy URL; the base form is http://127.0.0.1:8765/overlay). Leave Local file unchecked in OBS and paste the URL. Set size 1920×1080.
  • Set FPS to 30 or 60. Keep the source at the full canvas: the overlay positions the captions itself.
  • Disable "Shut down source when not visible" and "Refresh browser when scene becomes active" — both can drop the WebSocket connection.
  • While the system is running, the copied overlay URL includes the active WebSocket port. The server starts at ws_port (default 8765) and may use an alternative up to ws_port + 9; copy the URL again if the port changes.

Connection behavior

  • Anti-burst reconnect. The bundled /overlay page retries with exponential backoff from 1 s up to 8 s, rescans ports ws_port through ws_port + 9, and uses anti-burst reconnection so captions stay clean if OBS reconnects mid-stream. A custom client needs its own retry logic.
  • Broadcast. Every connected client receives every message. Multiple clients (OBS plus a debug browser tab) all see the same stream, and a slow client does not block the others.
  • Slow clients. Each client has a 64-frame outgoing queue and a 10-frame retry queue. When the retry queue is full the oldest frame is dropped; the client is not disconnected.

Build your own client

Any localhost WebSocket client can subscribe to the same broadcast OBS reads. A minimal browser client. Serve it from a local HTTP server and add that server's port to Allowed local connections: a page opened from file:// sends Origin: null and is rejected with 403. It skips frames that have a type field and renders only caption frames:

client.html
<!-- serve from a local http server, e.g. python -m http.server 5500
     (file:// sends Origin: null and gets 403), then allow port 5500 in
     Advanced > Allowed local connections -->
<div id="caption"></div>
<script>
  const PORT = 8765; // base port; the effective port is announced in the hello frame
  let ws;
  function connect() {
    ws = new WebSocket("ws://127.0.0.1:" + PORT);
    ws.onmessage = (e) => {
      const msg = JSON.parse(e.data);
      if ("type" in msg) return;  // hello, theme, subtitle_partial: not a caption
      document.getElementById("caption").textContent = msg.text;
    };
    // retry after 3 s if the connection drops (this sample's own choice)
    ws.onclose = () => setTimeout(connect, 3000);
  }
  connect();
</script>

Or a minimal Python client, to print every caption as it arrives (requires the websockets package; non-browser clients send no Origin, so no allowlist entry is needed):

ws_client.py
import asyncio, json, websockets

async def main():
    # ping_interval=None: the server answers pings only after its replay burst
    async with websockets.connect("ws://127.0.0.1:8765", ping_interval=None) as ws:
        async for frame in ws:
            msg = json.loads(frame)
            if "type" in msg:  # hello, theme, subtitle_partial...: not a caption
                continue
            print(msg["text"])

asyncio.run(main())

Debug signals

These signals tell you where a stalled overlay is stuck:

SignalMeaning
WS: <port> pill in the appThe WebSocket server is running on that port, with the number of connected clients. Use this port if you build your own client. WS: off means the service is stopped.
Browser devtools (F12) on the overlay pageNetwork → WS shows the frames the overlay receives; the Console shows its errors.
Error parseando WebSocket (console)A non-JSON message reached the overlay — the payload was not a valid frame.
HTTP 403 on the handshakeThe page's Origin is not allowed. Add its port in Allowed local connections; check Recent blocked attempts.