Guides
Task-by-task guides for building HTTP services with simoom: routing, slow work, streaming, WebSocket, TLS, HTTP/3, limits and the client.
- Getting started with simoom Add simoom with cargo add simoom, write one function that answers a request, and call start(); a working HTTP server takes about ten lines.
- How do I read requests and send responses in simoom? A service gets a borrowed Request and a Reply; read the request, then finish the reply once with a body, a stream, a deferred answer or an upgrade.
- How do I route requests by path and method in simoom? Build a Router with .get, .post and friends; :name or {name} captures a segment, *name the rest, and wrong methods get 405 automatically.
- How do I call a database or a service from a simoom handler? Never block the loop thread: wrap slow handlers in simoom::blocking, or use Reply::offload, or Reply::defer and answer later from your own threads.
- How do I stream bodies and server-sent events with simoom? Reply::stream and Reply::sse return a BodySink you write from any thread; large uploads arrive through a BodySource read off the loop thread.
- How do I accept WebSocket connections with simoom? Implement WebSocketHandler and answer with reply.websocket(handler); the handler runs on the loop thread, and a WsHandle sends from other threads.
- How do I serve HTTPS with simoom? Turn on the tls feature, load your certificate into a ServerConfig, and call listen_tls and tls; simoom does TLS 1.3 itself, with no OpenSSL.
- How do I serve HTTP/2 and HTTP/3 with simoom? HTTP/2 is on by default (h2c on plain listeners, ALPN over TLS); for HTTP/3 build with full and add listen_quic with quic_tls on the same port number.
- What does simoom limit and refuse, and how do I change it? Every resource has a limit in simoom::Limits with a safe default; ambiguous requests are refused, and a panicking handler becomes a 500, not a crash.
- How do I set simoom's threads, I/O back end and shutdown? simoom runs one event loop per CPU core by default; set threads, pick a Backend, and stop with stop(grace) followed by join().
- How do I make HTTP requests with simoom-client? simoom-client is a blocking HTTP/1.1, HTTP/2 and HTTP/3 client with pooling, TLS, redirects and WebSocket; add it with cargo add simoom-client.
- Which simoom features do I need, and how big is the build? Every protocol is a cargo feature: defaults give HTTP/1.1, HTTP/2 and WebSocket, full adds TLS and HTTP/3; HTTP/1.1 alone adds about 215 KB.
- Can I use simoom's protocol crates in my own I/O loop? Yes: simoom's HTTP/1.1, HTTP/2, QUIC, HTTP/3 and TLS crates are sans-io; they take bytes and time, return bytes and events, and never touch sockets.
- Rules for coding agents writing simoom code simoom has no async: services are plain functions on the loop thread that must not block; slow work goes to blocking, Reply::offload or Reply::defer.
- simoom FAQ Short answers about simoom: no async runtime, zero dependencies, HTTP/3 without quinn, small builds, what it doesn't do, and how ready it is.