/** * WS transport constants — mirrors Rust `session.rs` constants. */ /** Server heartbeat interval (30s) — client should send ping within this window. */ export const HEARTBEAT_INTERVAL_MS = 30_000; /** Server heartbeat timeout (60s) — disconnect if no pong received. */ export const HEARTBEAT_TIMEOUT_MS = 60_000; /** Max idle timeout (300s) — disconnect if no activity. */ export const MAX_IDLE_TIMEOUT_MS = 300_000; /** Client-side ping interval — send ping every 25s (before server 30s timeout). */ export const CLIENT_PING_INTERVAL_MS = 25_000; /** Rate limit: max messages per second per connection. */ export const MAX_MESSAGES_PER_SECOND = 1000; /** Max text message length (64KB). */ export const MAX_TEXT_MESSAGE_LEN = 64 * 1024; /** Deduplication window (5 minutes). */ export const DEDUP_WINDOW_MS = 5 * 60_000; /** Reconnection base delay (1 second). */ export const RECONNECT_BASE_DELAY_MS = 1_000; /** Reconnection max delay (30 seconds). */ export const RECONNECT_MAX_DELAY_MS = 30_000; /** Reconnection max attempts before giving up. */ export const RECONNECT_MAX_ATTEMPTS = 20; /** Protocol version — incremented when event types or fields change. */ export const WS_PROTOCOL_VERSION = 1; /** Default WS endpoint path on the Rust backend. */ export const DEFAULT_WS_PATH = '/ws'; /** WS token endpoint (POST /api/ws/token). */ export const WS_TOKEN_ENDPOINT = '/api/ws/token'; /** WS token TTL (from server response). */ export const WS_TOKEN_TTL_SECONDS = 300; /** SSE AI stream endpoint pattern. */ export const SSE_AI_STREAM_PATTERN = '/ws/ai-stream/{room_id}/{message_id}';