Optional wire-level WebSocket/Noise process for WhatsApp Web.
This module exchanges already-prepared binary nodes and frames. It does not own session supervision, Signal sessions, device fanout, sender keys, synchronized state, retry, or reconnect policy. It therefore must not be used as a shortcut for high-level message sending.
Use ExWapp.Client.Transport.Session for production messaging. Use this
module directly only for protocol tooling or as the wire layer underneath a
complete session implementation.
Summary
Functions
Starts Noise and returns the first WebSocket payload to send.
Encodes a node into an encrypted WebSocket payload.
Encrypts and frames a plaintext transport payload.
Creates a transport state machine without opening a socket.
Decodes inbound WebSocket bytes into raw payloads or decoded nodes.
Sends an already-prepared binary node through the wire transport.
Sends an already encoded plaintext payload through a running transport.
Starts a WebSockex process.
Types
@type event() :: {:connected, pid()} | {:disconnected, term()} | {:node, ExWapp.Binary.binary_node()} | {:raw, binary()} | {:handshake, :started | :completed} | {:error, term()}
Functions
@spec connect(ExWapp.Transport.WebSocket.State.t()) :: {:ok, ExWapp.Transport.WebSocket.State.t(), binary()} | {:error, term()}
Starts Noise and returns the first WebSocket payload to send.
@spec encode_node( ExWapp.Transport.WebSocket.State.t(), ExWapp.Binary.binary_node() | tuple() ) :: {:ok, ExWapp.Transport.WebSocket.State.t(), binary()} | {:error, term()}
Encodes a node into an encrypted WebSocket payload.
@spec encode_payload(ExWapp.Transport.WebSocket.State.t(), binary()) :: {:ok, ExWapp.Transport.WebSocket.State.t(), binary()} | {:error, term()}
Encrypts and frames a plaintext transport payload.
@spec new( ExWapp.Client.t(), keyword() ) :: ExWapp.Transport.WebSocket.State.t()
Creates a transport state machine without opening a socket.
Useful for host-owned sockets and tests.
@spec receive_bytes(ExWapp.Transport.WebSocket.State.t(), binary()) :: {:ok, ExWapp.Transport.WebSocket.State.t(), [event()]} | {:error, term()}
Decodes inbound WebSocket bytes into raw payloads or decoded nodes.
@spec send_node(pid(), ExWapp.Binary.binary_node() | tuple()) :: :ok
Sends an already-prepared binary node through the wire transport.
The caller is responsible for all required session and Signal processing.
Sends an already encoded plaintext payload through a running transport.
@spec start_link( ExWapp.Client.t(), keyword() ) :: GenServer.on_start()
Starts a WebSockex process.
Events are sent to :owner as {:ex_wapp_transport, event} messages.