Mint.WebSocket.new
You're seeing just the function
new
, go back to Mint.WebSocket module for more information.
Specs
new(Mint.HTTP.t(), reference(), pos_integer(), Mint.Types.headers()) :: {:ok, Mint.HTTP.t(), t(), [Mint.Types.response()]} | {:error, Mint.HTTP.t(), error()}
Creates a new WebSocket data structure given the server's reply to the upgrade request
This function will setup any extensions accepted by the server using
the Mint.WebSocket.Extension.init/2
callback.
Examples
http_reply = receive(do: (message -> message))
{:ok, conn, [{:status, ^ref, status}, {:headers, ^ref, headers}, {:done, ^ref}]} =
Mint.HTTP.stream(conn, http_reply)
{:ok, conn, websocket} =
Mint.WebSocket.new(conn, ref, status, resp_headers)