WebSockets

Connecting

Connect with an access token or an mcp_ key — as ?token=, as Authorization: Bearer, or with a one-time ticket from POST /api/auth/ws-ticket/ (preferred for browsers). ck_ keys are not accepted on sockets.

Every socket is organization-scoped; a socket for a conversation or project you cannot read closes with 4003.

Send {"type":"ping"} to receive {"type":"pong"}.

Routes

wss://<tenant>.cognethics.com/ws/events/

Platform-wide event and notification stream. Messages:

  • pong — reply to a ping.
  • event.push{event_id, topic, occurred_at, actor_type, correlation_id, chain_depth, org_id, subscription_id, subscription_name, event_count, payload}.
  • notification.push{notification}.

wss://<tenant>.cognethics.com/ws/chat/<conversation_id>/

Streaming agent chat. Messages:

  • pong — reply to a ping.
  • <event_type>{data, instance_id, timestamp}, one per streamed event as the agent works.
  • completed{message_id, content, tool_calls, processing_time_ms}.
  • error{message, instance_id}.

wss://<tenant>.cognethics.com/ws/pmo/projects/<project_id>/

Live project events, org-scoped, agent keys honored.

Close codes

4001 — authentication required. 4003 — forbidden (not authenticated for this socket, or scoped outside your organization).