Docs/Stream/Real-Time Chat & Moderation

Real-Time Chat & Distributed Moderation

The Vyntech Stream Chat Engine provides a high-throughput, low-latency WebSocket messaging environment backed by Redis for multi-node state synchronization and PostgreSQL for compliance audit logs.

WebSocket Connection & Auth

Clients establish a persistent bidirectional connection by connecting to the chat upgrade endpoint:

WebSocket Handshake Endpointwss://stream.apis.vyntech.com.au/ws/chat?stream_id={stream_id}&token={viewer_jwt}&fingerprint={hardware_fp}

The HTTP upgrade handler performs zero-trust token validation, verifying that the client IP and device fingerprint match the stored session before allowing messages to pass.

Distributed State Management (Redis)

To support high-concurrency broadcasts across multiple Kubernetes nodes, all mutable room states are synchronized via Redis:

Live Presence

Viewer join and leave events increment/decrement Redis HyperLogLog sets, computing real-time audience size across all nodes.

Global Room Locking

When a moderator toggles room lock, a Redis key is set with Pub/Sub broadcast, instructing all pods to reject non-moderator messages.

Cross-Pod Throttling

Slow-mode timestamps and message hashes are checked in Redis, preventing users from bypassing limits by reconnecting to another pod.

Moderation Command Suite

Authorized users (chat:moderate permission) can transmit real-time moderation frames:

Action CommandPayload SampleBehavior & Effect
delete_message{"action":"delete_message", "message_id":"msg_401"}Removes message from all viewer screens.
timeout{"action":"timeout", "user_id":"usr_91", "seconds":300}Mutes user for specified duration.
ban{"action":"ban", "user_id":"usr_91"}Permanently revokes chat permissions for user.
stream_ban{"action":"stream_ban", "user_id":"usr_91"}Kicks from chat AND terminates WebRTC video feed.
toggle_lock{"action":"toggle_lock", "locked":true}Locks room so only moderators can post.

AI Toxicity Screening

The chat pipeline integrates pluggable AI toxicity classifiers. You can also trigger moderation actions via REST API:


Trigger Chat Moderation ActionAuth

Send programmatic moderation commands to mute users, remove abusive messages, or toggle room lock.

Payload Example

{
  "action": "delete_message",
  "message_id": "msg_401",
  "reason": "Violating code of conduct"
}

Status Codes

  • Name
    200
    Type
    HTTP
    Description
    Moderation action broadcasted to all chat nodes
  • Name
    403
    Type
    HTTP
    Description
    Requires chat:moderate or stream:admin role
Request
POST/v1/stream/channels/{id}/chat/moderate
Response 200
← Zero-Trust & RBACEncoder & OBS Setup Guide →

We use cookies and similar technologies to measure traffic and improve the site. You can choose which categories to allow. Manage Preferences.