How shyambandla/samlang_uws works
samlang_uws is a small samlang binding for uWebSockets. A samlang application supplies event callbacks and starts the server; the native shim dispatches HTTP and WebSocket events, exposes the current request or message to samlang, and accepts response or socket operations back. The README documents the samlang API, while the sampled C++ shows the native event loop and callbacks. The samlang implementation was not sampled, so its internal wrapper calls are not expanded.
Main entry points: server.sam Server API · uws_shim.cpp WebSocket dispatch
Components 13
Samlang API
- Server API
server.sam
Native shim
- Event loop
uws_shim.cpp - HTTP dispatch
uws_shim.cpp - Request context
uws_shim.cpp - Request accessors
uws_shim.cpp - HTTP response
uws_shim.cpp - Pending headers
uws_shim.cpp - WebSocket dispatch
uws_shim.cpp - Socket registry
uws_shim.cpp - Socket operations
uws_shim.cpp
External clients
- HTTP client
- WebSocket client
Other components
- Samlang application
Connections 19
- Samlang application → Server API: uses
README.md - Server API → Event loop: starts
README.md - Event loop → HTTP dispatch: dispatches
uws_shim.cpp - HTTP dispatch → Request context: sets
uws_shim.cpp - HTTP dispatch → Samlang application: calls request
uws_shim.cpp - Server API → Request accessors: reads context
README.md - Request accessors → Request context: reads
uws_shim.cpp - Samlang application → Server API: answers via
README.md - Server API → HTTP response: responds
README.md - Server API → Pending headers: sets headers
README.md - HTTP response → Pending headers: writes
uws_shim.cpp - Event loop → WebSocket dispatch: dispatches
uws_shim.cpp - WebSocket dispatch → Request context: sets message
uws_shim.cpp - WebSocket dispatch → Socket registry: registers sockets
uws_shim.cpp - WebSocket dispatch → Samlang application: calls callbacks
uws_shim.cpp - Server API → Socket operations: sends or closes
README.md - Socket operations → Socket registry: looks up socket
uws_shim.cpp - HTTP client → HTTP dispatch: sends requests
README.md - WebSocket client → WebSocket dispatch: exchanges frames
README.md