ExUtcp.Transports.WebRTC.Signaling (ex_utcp v0.3.2)

Copy Markdown View Source

WebRTC signaling server client for exchanging SDP and ICE candidates.

Handles communication with the signaling server for:

  • SDP offer/answer exchange
  • ICE candidate exchange
  • Peer discovery and connection establishment

Summary

Functions

Returns a specification to start this module under a supervisor.

Closes the signaling connection.

Sends an SDP answer to the remote peer.

Sends an ICE candidate to the remote peer.

Sends an SDP offer to the remote peer.

Starts the signaling client.

Types

t()

@type t() :: %ExUtcp.Transports.WebRTC.Signaling{
  connection_state: atom(),
  parent_pid: pid(),
  peer_id: String.t() | nil,
  server_url: String.t(),
  websocket_pid: pid() | nil
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(pid)

@spec close(pid()) :: :ok

Closes the signaling connection.

send_answer(pid, answer, peer_id)

@spec send_answer(pid(), map(), String.t()) :: :ok | {:error, term()}

Sends an SDP answer to the remote peer.

send_ice_candidate(pid, candidate, peer_id)

@spec send_ice_candidate(pid(), map(), String.t()) :: :ok | {:error, term()}

Sends an ICE candidate to the remote peer.

send_offer(pid, offer, peer_id)

@spec send_offer(pid(), map(), String.t()) :: :ok | {:error, term()}

Sends an SDP offer to the remote peer.

start_link(server_url, parent_pid)

@spec start_link(String.t(), pid()) :: {:ok, pid()} | {:error, term()}

Starts the signaling client.