cnctd_server
HTTP + WebSocket server framework for Connected Dot services. Built on axum; the public API does not expose it.
Install
[]
= "1.0.0-alpha.2"
Quick start
use ;
use json;
;
async
GET /api/hello/world → {"success":true,"status":"OK","msg":null,"data":{"hello":"world"}}.
Anything that is not a file under client/dist serves index.html.
What you get
- Envelopes via macros:
success_data!,success_msg!,created!,bad_request!,unauthorized!,forbidden!,not_found!,internal_server_error!, and the rest of the 4xx/5xx set. - Other bodies:
Response::Binary,Response::Redirect,Response::Stream,Response::Sse. - Request context: method, full path, prefix, query, raw body, lenient
parsed data, lowercase headers, auth token (
req.bearer()strips the prefix), the caller's WebSocketClient-Id, first-hop client IP. - WebSocket with a connection table: register over REST or inline on the
upgrade (
/ws?subscriptions=a,b), optional JWT at upgrade, push by channel / user / connection / key-value, binary frames both ways, disconnect hook, heartbeat onserver-info. - Operations: CORS with an origin list, body size limit, graceful
shutdown (
CnctdServer::bindreturns aRunningServer),tracinglogs. - More than one instance: feature
redisfans pushes out over Redis pub/sub; setSocketConfig.redis_urlor pass aRedisFanout. - One wire contract: the types are the
cnctd_protocolcrate, shared withcnctd_clientand generated into thecnctd-servernpm package.
Full reference: CLAUDE.md. Moving from 0.6: MIGRATION.md.
License
MIT