View Source Minch.Conn (Minch v0.1.0)
Minch WebSocket connection.
Summary
Functions
Gracefully closes the connection if it's still open.
Opens a new connection.
Send a frame via the connection.
Wraps Mint.WebSocket.stream/2
and decodes WebSocket frames.
Types
@type response() :: %{ optional(:status) => Mint.Types.status(), optional(:headers) => Mint.Types.headers(), optional(:data) => binary(), optional(:error) => term(), optional(:frames) => [Mint.WebSocket.frame()] }
@type t() :: %Minch.Conn{ conn: Mint.HTTP.t(), request_ref: Mint.Types.request_ref(), websocket: Mint.WebSocket.t() | nil }
Functions
Gracefully closes the connection if it's still open.
@spec open(String.t() | URI.t(), Mint.Types.headers(), Keyword.t()) :: {:ok, t()} | {:error, Mint.WebSocket.error()}
Opens a new connection.
For the available options see Mint.HTTP.connect/4
and Mint.WebSocket.upgrade/5
functions.
Wraps Mint.HTTP.open?/2
.
@spec send_frame(t(), Mint.WebSocket.frame() | Mint.WebSocket.shorthand_frame()) :: {:ok, t()} | {:error, t(), Minch.Conn.NotUpgradedError.t() | Mint.Types.error() | term()}
Send a frame via the connection.
@spec stream(t(), term()) :: {:ok, t(), response()} | {:error, t(), Mint.Types.error() | Mint.WebSocketError.t() | Minch.Conn.UpgradeFailureError.t()} | :unknown
Wraps Mint.WebSocket.stream/2
and decodes WebSocket frames.