View Source ExICE.ICEAgent (ex_ice v0.2.0)
ICE Agent.
Not to be confused with Elixir Agent.
Link to this section Summary
Types
Emitted when connection state has changed.
Emitted when gathering process state has changed.
ICE Agent configuration options.
ICE agent role.
Messages sent by the ExICE.
Functions
Adds a remote candidate.
Returns a specification to start this module under a supervisor.
Informs ICE agent that a remote side finished its gathering process.
Starts ICE gathering process.
Gets local credentials.
Restarts ICE.
Sends data.
Sets remote credentials.
Starts and links a new ICE agent.
Link to this section Types
@type connection_state_change() ::
{:connection_state_change, :checking | :connected | :completed | :failed}
Emitted when connection state has changed.
For exact meaning refer to the W3C WebRTC standard, sec. 5.6.4.
@type gathering_state_change() ::
{:gathering_state_change, :new | :gathering | :complete}
Emitted when gathering process state has changed.
For exact meaning refer to the W3C WebRTC standard, sec 5.6.3.
@type opts() :: [ ip_filter: (:inet.ip_address() -> boolean()), stun_servers: [String.t()] ]
ICE Agent configuration options.
ip_filter
- filter applied when gathering local candidatesstun_servers
- list of STUN servers
Currently, there is no support for local relay (TURN) candidates however, remote relay candidates work correctly.
@type role() :: :controlling | :controlled
ICE agent role.
:controlling
agent is responsible for nominating a pair.
@type signal() :: {:ex_ice, pid(), gathering_state_change() | connection_state_change() | {:data, binary()} | {:new_candidate, binary()}}
Messages sent by the ExICE.
Link to this section Functions
Adds a remote candidate.
If an ICE agent has already gathered any local candidates and have remote credentials set, adding a remote candidate will start connectivity checks.
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec end_of_candidates(pid()) :: :ok
Informs ICE agent that a remote side finished its gathering process.
Call to this function is mandatory to nominate a pair (when an agent is the controlling
one)
and in turn move to the completed
state.
@spec gather_candidates(pid()) :: :ok
Starts ICE gathering process.
Once a new candidate is discovered, it is sent as a message to the controlling process.
See signal/0
for a message structure.
Gets local credentials.
They remain unchanged until ICE restart.
@spec restart(pid()) :: :ok
Restarts ICE.
If there were any valid pairs in the previous ICE session, data can still be sent.
Sends data.
Can only be called after moving to the connected
state.
Sets remote credentials.
Call to this function is mandatory to start connectivity checks.
@spec start_link(role(), opts()) :: GenServer.on_start()
Starts and links a new ICE agent.
Process calling this function is called a controlling process
and
has to be prepared for receiving ExICE messages described by signal/0
.