BaileysEx.Connection.Transport behaviour (baileys_ex v0.1.0-alpha.9)

Copy Markdown View Source

Evented transport behaviour for the connection socket runtime.

Transport implementations own HTTP and WebSocket connectivity and expose raw binary frame events back to the socket, which remains the owner of Noise and higher-level connection state.

Summary

Types

event()

@type event() ::
  :connected | {:binary, binary()} | {:closed, term()} | {:error, term()}

Callbacks

connect(t, term)

@callback connect(BaileysEx.Connection.Config.t(), term()) ::
  {:ok, term()} | {:error, term()}

disconnect(term)

@callback disconnect(term()) :: :ok

handle_info(term, term)

@callback handle_info(term(), term()) ::
  {:ok, term(), [event()]} | {:error, term(), term()} | :unknown

send_binary(term, binary)

@callback send_binary(term(), binary()) :: {:ok, term()} | {:error, term(), term()}