Mint.WebSocket.decode

You're seeing just the function decode, go back to Mint.WebSocket module for more information.

Specs

decode(t(), data :: binary()) ::
  {:ok, t(), [frame() | {:error, term()}]} | {:error, t(), any()}

Decodes a binary into a list of frames

The binary may received from the connection with Mint.HTTP.stream/2.

This function will invoke the Mint.WebSocket.Extension.decode/2 callback for any accepted extensions.

Examples

message = receive(do: (message -> message))
{:ok, conn, [{:data, ^ref, data}]} = Mint.HTTP.stream(conn, message)
{:ok, websocket, frames} = Mint.WebSocket.decode(websocket, data)