Skip to content

Streaming Chat API (WebSocket) #20

@antiv

Description

@antiv

Summary

WebSocket-based streaming chat API alongside existing SSE. Better suited for real-time bidirectional communication, multi-turn rapid exchanges, and mobile clients.

Motivation

SSE works for one-way streaming but WebSocket is the standard for chat applications. Mobile SDKs and most frontend frameworks have better WebSocket support. Enables features like typing indicators, read receipts, and real-time presence.

Scope

  • WebSocket endpoint (/ws/chat)
  • Auth handshake (token-based, compatible with existing auth)
  • Message protocol: JSON frames for user messages, agent responses, events
  • Connection management: heartbeat, auto-reconnect, session resume
  • Typing indicators and presence (optional)
  • Backward compatible: SSE continues to work

Acceptance Criteria

  • WebSocket chat endpoint working with auth
  • Streaming agent responses via WebSocket
  • Reconnection with session continuity
  • SSE endpoint unchanged (backward compatible)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priorityapiAPI endpointsenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions