View Source Specter (specter v0.1.0)

Specter is a method for managing data structures and entities provided by webrtc.rs. It is intended as a low-level library with some small set of opinions, which can composed into more complex behaviors by higher-level libraries and applications.

usage

Usage

A process initializes Specter via the init/1 function, which registers the current process for callbacks that may be triggered via webrtc entities.

iex> {:ok, specter} = Specter.init(ice_servers: ["stun:stun.l.google.com:19302"])
iex> {:ok, _uuid} = Specter.new_media_engine(specter)

thoughts

Thoughts

During development of the library, it can be assumed that callers will implement handle_info/2 function heads appropriate to the underlying implementation. Once these are more solid, it would be nice to use Specter, which will inject a handle_info/2 callback, and send the messages to other callback functions defined by a behaviour. handle_ice_candidate, and so on.

Link to this section Summary

Types

A STUN uri in the form protocol:host:port, where protocol is either stun or turn.

Options for initializing RTCPeerConnections. This is set during initialization of the library, and later used when creating new connections.

t()

Specter.t/0 references are returned from init/1, and represent the state held in the NIF. All functions interacting with NIF state take a Specter.t/0 as their first argument.

While entities managed by Specter are generally accessed via the Specter.t/0 returned from init/1, specific entities are accessed via UUIDs returned from the functions used to initialize them (e.g. new_rtc_peer_connection/1).

Functions

Returns the currently

Initialize the library. This registers the calling process to receive callback messages to handle_info/2.

Link to this section Types

Specs

ice_server() :: String.t()

A STUN uri in the form protocol:host:port, where protocol is either stun or turn.

Defaults to stun:stun.l.google.com:19302.

Specs

init_options() :: [] | [{:ice_servers, [ice_server()]}]

Options for initializing RTCPeerConnections. This is set during initialization of the library, and later used when creating new connections.

Specs

t()

Specter.t/0 references are returned from init/1, and represent the state held in the NIF. All functions interacting with NIF state take a Specter.t/0 as their first argument.

Specs

uuid() :: String.t()

While entities managed by Specter are generally accessed via the Specter.t/0 returned from init/1, specific entities are accessed via UUIDs returned from the functions used to initialize them (e.g. new_rtc_peer_connection/1).

Link to this section Functions

Specs

config(t()) :: {:ok, Specter.Config.t()} | {:error, term()}

Returns the currently

Specs

init(init_options()) :: {:ok, t()} | {:error, term()}

Initialize the library. This registers the calling process to receive callback messages to handle_info/2.

paramtypedefault
ice_serverslist(String.t())["stun:stun.l.google.com:19302"]

Specs

new_media_engine(t()) :: {:ok, uuid()}