gluegun/message
gluegun/message
Section titled “gluegun/message”Decoding and awaiting asynchronous Gun stream messages.
Gun sends HTTP, HTTP/2 push, upgrade, and WebSocket events as Erlang messages. This module decodes those messages into Gleam types for callers using lower-level streaming or advanced flows.
WebSocket frames delivered inside Gun stream messages.
Close represents a plain close with no status code or reason.
CloseWithReason carries a numeric close code and an opaque reason payload.
On the wire Gun delivers close (atom) as Close and
{close, Code, Reason} as CloseWithReason.
Text(String)Binary(BitArray)Ping(BitArray)Pong(BitArray)Close()CloseWithReason(Int, BitArray)
Message
Section titled “Message”Gun HTTP stream messages delivered by the Erlang Gun client.
Inform(Int, List(#(String, String)))Response(gluegun/fin.Fin, Int, List(#(String, String)))Data(gluegun/fin.Fin, BitArray)Trailers(List(#(String, String)))Push(gluegun/internal.Stream, gluegun/request.Method, String, List(#(String, String)))Upgrade(List(String), List(#(String, String)))WebSocket(gluegun/message.Frame)
Type aliases
Section titled “Type aliases”GluegunError
Section titled “GluegunError”Alias for gluegun/error.GluegunError.
pub type GluegunError = UnknownHeader
Section titled “Header”Alias for gluegun/request.Header used in decoded messages.
pub type Header = UnknownMethod
Section titled “Method”Alias for gluegun/request.Method used in decoded messages.
pub type Method = UnknownFunctions
Section titled “Functions”Await the next Gun message for a stream.
pub fn await(gluegun/internal.Connection, gluegun/internal.Stream, gluegun/connection.Timeout) -> Result(gluegun/message.Message, gluegun/error.GluegunError)await_body
Section titled “await_body”Await and collect the full response body for a stream.
pub fn await_body(gluegun/internal.Connection, gluegun/internal.Stream, gluegun/connection.Timeout) -> Result(BitArray, gluegun/error.GluegunError)decode
Section titled “decode”Decode a raw Erlang Gun message into a typed Gleam message.
pub fn decode(gleam/dynamic.Dynamic) -> Result(gluegun/message.Message, gluegun/error.GluegunError)decode_ffi_error
Section titled “decode_ffi_error”Decode a raw Erlang FFI error into GluegunError.
pub fn decode_ffi_error(gleam/dynamic.Dynamic) -> gluegun/error.GluegunError