// CONTENTS Part 12 · Reference library

// PART 12

Full WebSocket reference

Chapter 50 / 56 2 min read English Part 12 of 14

12 routes in the ws family. Inventory says whether the route is also listed in the API command catalog; Registered in is the file that mounts it.

Base URL: http://localhost:8080 — see Network Contract.

Method Path Summary Inventory Registered in
GET /ws/:param schema not modeled no botserver/src/main_module/routes/api_setup.rs
GET /ws/canvas/:param schema not modeled no botserver/crates/botcanvas/src/lib.rs
GET /ws/docs/:param schema not modeled no botserver/crates/botdocs/src/lib.rs
GET /ws/events schema not modeled no botserver/src/main_module/routes/feature_merge_platform/commerce.rs
GET /ws/events/stream schema not modeled no botserver/src/main_module/routes/feature_merge_platform/commerce.rs
GET /ws/logs schema not modeled no botserver/crates/botmonitoring/src/lib.rs

All families appear in the generated WebSocket reference; the table above is the ws family inventory, regenerated by python3 scripts/gen_api_reference.py --check.

Chat socket reference

The main socket (/ws/:param) is the transport of the chat pipeline (botserver/src/core/bot/ws/):

Handshake. Identity resolves in this order — a token (cookie gb-access-token, then the access_token/token query field) resolved by anonymous_auth::resolve_token_user; then the user_id query value; then a new guest. The handshake logs which source won. Open the socket only after your auth call has answered.

Message types.

ID Name Direction Notes
0 EXTERNAL in external message
1 USER in triggers a model turn
2 BOT_RESPONSE out bot reply
3 CONTINUE in continue processing
4 SUGGESTION in suggestion button (a normal turn)
5 CONTEXT_CHANGE in context switch
6 TOOL_EXEC in runs the tool .ast directly — no LLM, no KB

Streaming. Replies arrive as chunks on the same socket (ws/stream/); suggestions are delivered per session from Redis (suggestions:{bot}:{session}).

Resuming. Run event frames persist in run_events (retention in days, configured by GB_RUN_EVENTS_RETENTION_DAYS); a reconnecting client resumes from them via the session resume path.

Office and monitoring sockets

/ws/events + /ws/events/stream carry the office event stream (fed by POST /api/events/publish); /ws/canvas/:param and /ws/docs/:param are the per-document collaboration sockets of the Canvas and Docs crates; /ws/logs streams monitoring logs (botmonitoring).

Client checklist

Concern Practice
Auth before connect the handshake is where identity sticks
Message types use the typed frames; type 6 bypasses the model by design
Verification browser (Chrome CDP) only — a raw WS client hides suite state
Channels other channels do not use this socket; they are webhook + buffered delivery

Found a mistake? Open an issue · All books

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move