Repository navigation
Guide WebTransport Server
CWIST exposes WebTransport over its HTTP/3 server. WebTransport requires TLS and QUIC; browsers also require a certificate they trust during development.
Platform note: the HTTP/3 listener uses
epollon Linux and a portable polling path on macOS/BSD. ECN receive metadata is optional, so missing BSD socket extensions do not block a WebTransport build or listener startup.
#include <cwist/sys/app/app.h>
static void on_webtransport(cwist_http_request *req,
cwist_http_response *res,
void *session) {
(void)req;
(void)session;
res->status_code = CWIST_HTTP_OK; /* Accept the CONNECT session. */
}
int main(void) {
cwist_app *app = cwist_app_create();
cwist_app_use_https3(app, true); /* Or configure certificate/key first. */
cwist_app_use_webtransport(app, on_webtransport);
int rc = cwist_app_listen(app, 4433);
cwist_app_destroy(app);
return rc;
}cwist_app_use_http3(app, true) is suitable for local experimentation because
it creates an ephemeral certificate. For a browser deployment, use a real TLS
certificate and make the public endpoint reachable over UDP.
WebTransport gives an application reliable streams and optional datagrams. Put a small versioned envelope around each application message, cap message sizes, and authenticate the session before accepting commands. Use streams for CRUD, chat history, and acknowledgements; use datagrams only for replaceable state such as cursor positions or game snapshots.
Do not assume datagrams arrive, arrive once, or arrive in order. Include a monotonic sequence number and discard stale updates. For reliable stream data, CWIST's sequence helpers can reassemble application-level fragmented payloads when a protocol intentionally splits large messages.
Set per-session limits for concurrent streams, buffered bytes, and idle time. Reject unsupported CONNECT paths before allocating a session. Log the request identifier, negotiated origin, close reason, and transport errors, but never log credentials or application payloads. Exercise the handler with the WebTransport regression test before enabling it on a public listener.
Source: docs/tutorials/webtransport-server.md on dev. Edit the source file in the repository; this page is regenerated from it.
CWIST wiki, written against the dev branch of c4punks/CWIST. Pages marked "Source:" are generated from files under docs/; fix those in the repository. Questions: Discord.
Getting started
- Installation
- Quick Start
- Linking
- Server Modes
- Configuration and Environment
- Project CLI
- Tutorial / Korean
- Examples and Tutorials
Guides
Core
- API Reference
- Application
- Routing
- Middleware
- Requests and Responses
- Async Handlers
- Streaming Responses
- Error Handling
- Graceful Shutdown
- Multiport
Protocols
- HTTPS and TLS
- HTTP/2
- HTTP/3 and QUIC
- WebTransport
- WebSocket
- Server-Sent Events
- gRPC Server
- gRPC Client
- Protobuf and Codegen
- GraphQL
- WebRTC DataChannels
- HTTP Clients
Web features
- Static Files and Assets
- Big Dumb Reply Cache
- Compression
- Cookies
- Sessions and Flash
- Query Maps
- Multipart Uploads
- HTML Components
- Templates
- JSON
- Validation
- OpenAPI
Security
Data
Runtime
- Memory Management
- Full GC
- Async GC Ownership
- SString
- Reactor and I/O
- Metrics and Health
- Logging
- Testing
Platforms
Performance notes
- Benchmark Methodology
- C1M File Limits
- Reactor Fairness
- Cooperative Queuing
- Classic Pool Starvation
- Reactor Wakeup
- wrk Dual Histogram
- FIXED Endpoint Cache
- ADR-0001
- Durable Queue Gate
- Mux References
Project