WebSockex v0.2.0 WebSockex.Frame

Functions for parsing and encoding frames.

Summary

Types

The incomplete or unhandled remainder of a binary

This is required to be valid UTF-8

Functions

Encodes a frame into a binary for sending

Parses and combines two frames in a fragmented segment

Parses a bitstring and returns a frame

Types

buffer()
buffer() :: bitstring

The incomplete or unhandled remainder of a binary

close_code()
close_code() :: 1000..4999
frame()
frame ::
  :ping |
  :pong |
  :close |
  {:ping, binary} |
  {:pong, binary} |
  {:close, close_code, utf8} |
  {:text, utf8} |
  {:binary, binary} |
  {:fragment, :text | :binary, binary} |
  {:continuation, binary} |
  {:fin, binary}
opcode()
opcode() :: :text | :binary | :close | :ping | :pong
utf8()
utf8() :: binary

This is required to be valid UTF-8

Functions

encode_frame(frame)
encode_frame(frame) ::
  {:ok, binary} |
  {:error, %WebSockex.FrameEncodeError{__exception__: term, close_code: term, frame_payload: term, frame_type: term, reason: term}}

Encodes a frame into a binary for sending.

parse_fragment(fragmented_parts, continuation_frame)
parse_fragment({:fragment, :text | :binary, binary}, {:continuation | :finish, binary}) ::
  {:fragment, :text | :binary, binary} |
  {:text | :binary, binary} |
  {:error, %WebSockex.FragmentParseError{__exception__: term, continuation: term, fragment: term, reason: term}}

Parses and combines two frames in a fragmented segment.

parse_frame(data)
parse_frame(bitstring) ::
  :incomplete |
  {:ok, frame, buffer} |
  {:error, %WebSockex.FrameError{__exception__: term, buffer: term, opcode: term, reason: term}}

Parses a bitstring and returns a frame.