BaileysEx.Connection.Coordinator (baileys_ex v0.1.0-alpha.12)

Copy Markdown View Source

Runtime wrapper around the raw connection socket.

This process owns wrapper concerns that Baileys keeps outside makeSocket: initial connect/reconnect policy, init queries, dirty-bit handling, and persisting emitted credential updates.

Summary

Functions

Returns a specification to start this module under a supervisor.

Request the phone to resend a placeholder message through the peer-data pipeline.

Send a message through the coordinator-owned runtime state.

Send an ACK/NACK through the coordinator-owned socket.

Send a failed-decryption retry request through the coordinator-owned retry lane.

Send a status message through the coordinator-owned runtime state.

Start the coordinator process. Accepts a keyword list containing :config, :event_emitter, :store, :signal_store, :supervisor, and :task_supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

request_placeholder_resend(server, message_key, msg_data \\ nil, opts \\ [])

@spec request_placeholder_resend(GenServer.server(), map(), map() | nil, keyword()) ::
  {:ok, String.t() | nil} | {:error, term()}

Request the phone to resend a placeholder message through the peer-data pipeline.

send_message(server, jid, content, opts \\ [])

@spec send_message(GenServer.server(), BaileysEx.JID.t(), map() | struct(), keyword()) ::
  {:ok, map()} | {:error, term()}

Send a message through the coordinator-owned runtime state.

send_message_ack(server, node, error_code \\ nil)

@spec send_message_ack(
  GenServer.server(),
  BaileysEx.BinaryNode.t(),
  non_neg_integer() | nil
) ::
  :ok | {:error, term()}

Send an ACK/NACK through the coordinator-owned socket.

send_retry_request(server, node, opts \\ [])

@spec send_retry_request(GenServer.server(), BaileysEx.BinaryNode.t(), keyword()) ::
  :ok | {:error, term()}

Send a failed-decryption retry request through the coordinator-owned retry lane.

send_status(server, content, opts \\ [])

@spec send_status(GenServer.server(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}

Send a status message through the coordinator-owned runtime state.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Start the coordinator process. Accepts a keyword list containing :config, :event_emitter, :store, :signal_store, :supervisor, and :task_supervisor.