Welcome to the Gluegun documentation!
Message Flow
Gun sends asynchronous messages to the process that owns or awaits a stream. Gluegun keeps that model visible and decodes those messages into typed Gleam values.
The main flow is:
- Open a connection with
gluegun/connection. - Start a stream with
gluegun/request. - Await stream messages with
gluegun/message. - Pattern match on
message.Response,message.Data,message.Trailers, WebSocket frames, or errors.
High-level gluegun/client helpers use this flow internally for regular HTTP responses. They are intentionally scoped to one request and collect the complete body in memory.
For advanced Gun behavior, keep using the lower-level request and message APIs so your application can decide how to handle streaming, flow control, cancellation, trailers, and protocol-specific events.
See the message reference for every decoded message variant.