Why a replacement issue
Issue #24 was written against an older architecture and references a Rust-side websocket.rs implementation that is no longer the right baseline for current main.
TurboAPI now has:
- Python-side WebSocket API/decorator surface in
python/turboapi/websockets.py
- route registration for
@app.websocket(...)
- documentation that still says Zig/runtime WebSocket support is planned
- no actual Zig runtime upgrade / frame / connection implementation in the current HTTP core
This replacement issue tracks the work against the current codebase shape.
Current state
What exists:
WebSocket and WebSocketDisconnect Python API objects
app.websocket() registration on the Python side
- parity-style tests for decorator/API surface
What does not exist yet in the Zig runtime:
- HTTP upgrade handling in the live server path
- WebSocket frame parsing/serialization
- live connection lifecycle wiring between the server and Python callbacks
- broadcast/pub-sub/runtime connection management
Task
Transport/runtime
- detect and validate
Connection: Upgrade / Upgrade: websocket requests in the Zig HTTP server path
- implement the opening handshake (
Sec-WebSocket-Key / accept hash)
- add frame parsing and serialization for text, binary, ping/pong, and close frames
- handle fragmentation/limits conservatively or explicitly document unsupported cases
Python integration
- bind accepted connections to the existing Python
WebSocket API surface
- support
accept(), close(), send_text(), send_bytes(), send_json(), receive_*() on real runtime connections
- map disconnects and protocol errors to
WebSocketDisconnect
Tests/docs
- add exact runtime tests that prove a real Zig-backed WebSocket echo/connect/disconnect path works
- update
docs/WEBSOCKET.md and README once runtime support actually exists
- document what is and is not supported in the first shipped version
Non-goals for the first pass
- full pub/sub manager if basic connection support is not stable yet
- advanced extensions/compression unless explicitly implemented
- claiming production readiness before the runtime path exists and is tested
Related issues
Why a replacement issue
Issue #24 was written against an older architecture and references a Rust-side
websocket.rsimplementation that is no longer the right baseline for currentmain.TurboAPI now has:
python/turboapi/websockets.py@app.websocket(...)This replacement issue tracks the work against the current codebase shape.
Current state
What exists:
WebSocketandWebSocketDisconnectPython API objectsapp.websocket()registration on the Python sideWhat does not exist yet in the Zig runtime:
Task
Transport/runtime
Connection: Upgrade/Upgrade: websocketrequests in the Zig HTTP server pathSec-WebSocket-Key/ accept hash)Python integration
WebSocketAPI surfaceaccept(),close(),send_text(),send_bytes(),send_json(),receive_*()on real runtime connectionsWebSocketDisconnectTests/docs
docs/WEBSOCKET.mdand README once runtime support actually existsNon-goals for the first pass
Related issues