The Durable Streams protocol
(§5) as a Plug, over
Slap.Streams. The stream's name is the full request path, under :prefix
(default /v1/stream). When mounted with Plug.forward/4, the mount path
precedes :prefix and is part of the stream name.
It does not authenticate: every request is allowed. Put authentication in
front of it, in the Plug pipeline that mounts it or in a proxy. An
authorization check by path must also cover the Stream-Forked-From
header of a PUT: creating a fork copies its source, so it reads that
path. With authentication, set :private_cache.
Options:
:prefix- only paths under it are streams (default"/v1/stream").:long_poll_timeout- ms a long-poll waits for data (default 30,000).:sse_timeout- ms before an SSE response ends, so clients reconnect and CDNs can collapse them (default 60,000).:max_body- the largest request body, in bytes (default 64 MiB). A largerContent-Lengthgets 413 before the body is read.:max_buffered- bytes of request bodies this VM holds at once (default 512 MiB). All Streams routers in the VM share the counter; configure the same limit on each. A request over it gets 503 withRetry-Afterbefore its body is read.:trust_forwarded- build theLocationof a created stream fromX-Forwarded-ProtoandX-Forwarded-Host(set it only behind a proxy that sets them). Defaultfalse.:max_read- about how many bytes one read returns (default 1 MiB).:max_path- the longest stream path, in bytes (default 512; 414 above it).:private_cache- sendCache-Control: privaterather thanpublicon cacheable historical reads (§8), so that a shared cache (a CDN) does not serve one user's reads to another. Defaultfalse.:cors-"*"(default), a specific origin such as"https://app.example", orfalseto omit CORS response headers.:cluster- Streams cluster serving these requests (defaultSlap.Streams.Cluster).
Each response sends a [:slap, :streams, :http, :request] telemetry
event.