OpenVibe.Live/Docs
Source on GitHub

Chat System#

The OpenVibe.Live chat system provides real-time messaging, moderation, and extensibility.

Architecture#

OpenVibe.Chat (roadmap Wave 6; live since 2026-09-23)#

Chat runs in OpenVibe.Chat (127.0.0.1:4400) with the same WebSocket protocol and REST paths. Live runs no chat server, and there is no switch (the CHAT_AUTHORITY flag was retired on 2026-10-11); the local ChatServer and its /ws/chat upgrade path are deleted. Without Live's service credentials (development, tests) chat is inert.

Features#

Real-time Chat#

Moderation Tools#

Chat Logs & Admin#

Settings Sync#

What people wear#

A chat line shows what its sender wears from OpenVibe.Inventory. Live is the issuer of the live.* kinds; the Workshop's community badges are network.badge.

OpenVibe.Chat asks Live for these through POST /internal/chat-context/decor. Live reads Inventory 100 people at a time and keeps each answer 30 seconds (server/monetization/inventory-client.js), and an Inventory outage just leaves names plain. People earn items through OpenVibe.Quest's quest rewards, or are given community badges by their makers in the Workshop. Nothing is bought or sold. The same items show on openvibe.chat, Community and Network profiles, drawn by openvibe-shared items.js.

Text-to-Speech (TTS)#

Admin Endpoints#

Chat Logs#

GET /api/chat/admin/logs?page=1&limit=50&username=bob&from=2024-01-01&to=2024-12-31

Export Logs#

GET /api/chat/admin/logs/export?format=csv
GET /api/chat/admin/logs/export?format=json

Purge Preview#

POST /api/chat/admin/purge/preview
Body: { "streamId": 123, "from": "2024-01-01T00:00:00Z", "to": "2024-01-02T00:00:00Z" }

Execute Purge#

DELETE /api/chat/admin/purge
Body: { "streamId": 123, "from": "2024-01-01T00:00:00Z", "to": "2024-01-02T00:00:00Z" }

from and to (also on the log filter and /api/chat/:streamId/replay) are UTC, as ISO instants or SQLite's YYYY-MM-DD HH:MM:SS; both bounds are inclusive. The preview, the purge, the log filter and VOD chat replay all read them the same way, so a purged range disappears from replay exactly.

WebSocket Protocol#

Connect#

wss://openvibe.live/ws/chat?stream=123
Authorization: Bearer JWT_OR_API_TOKEN        (non-browser clients)

Browsers send the token in the first join message instead ({ "type": "join", "streamId": 123, "token": "…" }): the socket is anonymous until then. Neither a cookie nor a ?token= query parameter signs a socket in (both removed 2026-10-10, OpenVibe.Chat#55).

Message Types (Client → Server)#

TypeFieldsDescription
chatmessageSend a chat message
joinstreamIdJoin a stream's chat room

Message Types (Server → Client)#

TypeFieldsDescription
chatusername, message, timestamp, ...Chat message
systemmessageSystem notification
deletemessageIdSingle message deleted
purgefromTime, toTimeBulk messages purged
ttstext, voiceServer-generated TTS event
tts-audiourlTTS audio file URL
user_countcountUser presence update

TTS playback hardening (2026-08-31)#

media-src now includes data: (the mod voice preview plays a data:audio/… URL; without it the element dies with "no supported source"). The admin Test Voice (POST /api/tts/admin/test) and mod preview (POST /api/mod/tts-voice/preview) additionally return a same-origin url — the clip is parked in the shared TTS cache (data/tts-cache) and streamed from GET /api/tts/audio/<hash>.<wav|mp3> (strict filename, no traversal) — so playback works even where a browser or shield refuses blob:/data: audio. Chat/broadcast TTS players retry once with a data: URL when the element rejects the blob URL. Note: tts-audio WS payloads carry base64 (audio + mimeType), not a url.

Auto-translation (non-English streamers)#

Every channel has a language it lives in: the streamer's explicit channels.chat_language (PUT /api/streams/channel with chat_language: 'ja' / 'auto' …), or, when auto, the language detected from any non-English line in their bio or name (server/i18n/translate.js). GET /api/streams/channel/:username returns it as language: { code, name, flag, explicit, translate }, and the chat auth frame carries channel_language so the composer can show the "Auto-translated ↔ Japanese" pill.

When AI is enabled (ai_enabled, and AI_SERVICE not off; the chat_translate_enabled site setting defaults to on), each chat line is translated a beat after it is broadcast and delivered to the same rooms as

{ "type": "chat_translation", "id": 123, "from": "ja", "to": "en", "text": "…" }

Direction rules: any non-English message → English; an English message in a non-English channel → the channel's language (so a Japanese streamer reads his chat without anyone typing Japanese). Emote-only / command / link-only lines are skipped. Translations are cached by content hash in the translations table and persisted by Chat into the message's metadata.translation, so history renders them too. Calls go through ai/llm.js (metered, budgeted, max 3 in flight; overflow lines simply stay untranslated).

Any line, your language. Every chat message also has a hover 🌐 button that asks POST /api/i18n/translate { text, to } for the line in the viewer's browser language (rate-limited per IP: 15/min anonymous, 40/min signed in; cached like the automatic translations). This is the third direction — a Korean viewer reading a Japanese streamer, a Japanese viewer on an English stream — so nobody is left out, English users included.

Related surfaces: GET /api/streams/channel/:username/bio-en (bio in English), GET /api/chat-ai/live-captions/:username (English rendering of live speech — needs the AI timeline on and a multilingual whisper model, see WHISPER_MODEL_MULTI), and the home-page "Star of OpenVibe" spotlight (GET /api/home/star, star_streamer setting / STAR_STREAMER env).

Friendly global chat (2026-09-17)#

A viewer-side setting (chat settings → Behavior). When on, messages in global chat that match FRIENDLY_FILTER_CATEGORIES in server/chat/moderation-utils.js (slurs, hate slogans, threats, sexual content, anything sexualising minors) fold into a "N messages hidden by Friendly chat · Show" line. Nothing is deleted and nobody is moderated for it. It is on for a viewer's first day (the chat auth message carries newcomer, from the account age or the anon's first sighting) unless the viewer chose otherwise; the rules come from GET /api/chat/filters/friendly.

History and rendering#

buildChatMessageEl() in public/js/chat.js renders every surface (page, popout, broadcast desk, floating widget). History renders off-screen: the newest 50 rows are swapped in at once, then the older scrollback (up to 500 channel + 500 global rows) is put above them 10 rows at a time, as many pieces as fit in each idle moment (_historyPieces), keeping the reader where they are. All of it in one task was a 2.7 s freeze on a phone-speed CPU (2026-10-17). The last 200 rows of a room are cached in localStorage per user for an instant paint on reload (its newest 50 render). The view follows new messages unless the reader scrolled back (_watchChatPin).

Live's activity in chat: going live and saved broadcasts (2026-11-19)#

Live posts its own activity as system rows that public/js/chat.js draws as one-line event cards (_chatEventOf: the streamer's picture, who and what, the time, and Watch). Chat keeps each row's key, so a repeat posts nothing.

RowChannel's chatGlobal chat
Going live (server/streaming/live-events.js postLiveLink): 🔴 <name> is live. Share the stream: …/@name, metadata live_linkAt once, not on a reconnect within the hourA minute later if the stream is still live (server/streaming/live-global.js): never an 18+ stream (its flag or the channel's forced one), a banned account's or an agent stream's; a channel at most once in 30 minutes, ten an hour in all
A saved broadcast (server/media-proxy/vod-notify.js, on Media's vod.ready): 📼 <name> saved a broadcast: "<title>" (1h 02m) at …/vod/<id>, metadata vod_linkPublic recordings of two minutes or moreThe same, never 18+; a channel at most once in 30 minutes, six an hour in all

The same person going live again within 15 minutes updates their card instead of adding another.

The overlay alert feed (2026-10-31)#

The moments a streamer wants on their OBS overlay — "X followed", "X tipped 5 Vibes: message", "X subscribed", "X raided with 12 viewers", "Goal reached" — arrive as one typed frame in the channel's own chat room, so an OBS browser source on openvibe.live can show them as they happen. The page itself is the streamer's own; Live sends the feed.

One frame per moment, on Chat's typed ingress (server/overlay/overlay-alerts.js):

{ type: 'overlay-alert', kind, id, at, who: { name, avatar }|null, amount: { value, unit }|null, text }

Live announces a moment where it already happens: a follow (server/social/network-follows.js), a tip (the on-site donation route, an OpenVibe.Tips delivery, a PowerChat tip), a subscription (Billing's settled transaction), and a goal reached (server/monetization/goal-announce.js). Live has no raid feature yet, so raid is only ever a test sample.

Nothing private is in the frame: no email, no account id, no Network subject, no Billing or Network internals. The tipper's words pass Chat's own moderation the way a chat line does (the blocked-word filter censors them, the channel's own filters drop them) — Chat does that when it delivers the frame.

POST /api/overlay/test-alert { kind } fires a sample of that kind into the streamer's own room, so they can line up OBS before the real thing happens. It is the streamer's own session only (the route takes no target), it is rate-limited (ten a minute), and it moves no money and credits no goal.

This page is rendered from docs/chat-system.md in the OpenVibe.Live repository. Found a mistake? Edit it there.