-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
WebSocket server + HTTP upgrade handoff (lib split, no std::function)
Goal
Add server-side WebSocket support and integrate it with THttpServer via a clean connection takeover mechanism, while keeping ws optional and avoiding std::function (single virtual dispatch only).
High-level design
- Keep
wsas a standalone library (users of core/http must not link it). httpmust be able to hand off an upgraded TCP connection (socket + prefetched bytes) to an external handler without knowing anything about WebSocket.- HTTP → WS integration is done via a small bridge library.
- Use virtual interfaces (one dispatch point), no type-erasure callbacks.
Library split
coroio_corecoroio_http(generic upgrade/takeover hook, no WS dependency)coroio_ws(WebSocket protocol + server session)coroio_http_ws(HTTP<->WS bridge)
Checklist
WebSocket server (ws)
- Add server-side WebSocket session support
- Support accepting an already-upgraded connection (socket + prefetch)
- Provide minimal public API for running a WS session loop
HTTP upgrade / takeover (http)
- Introduce a generic connection takeover mechanism
- Allow router to stop HTTP processing and transfer socket ownership
- Do not introduce
std::functionin hot paths
HTTP<->WS bridge (http_ws)
- Implement WebSocket upgrade handler using virtual interface
- Perform handshake and start WS session
- Allow routing upgrade requests by path
Testing / validation
- Standalone WebSocket server example (no HTTP)
- Integration test: HTTP upgrade → WebSocket session
Non-goals
- Forcing
wsdependency on core/http users - Adding multiple layers of dynamic dispatch
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels