Summary

Functions

Returns a specification to start this module under a supervisor.

Closes the worker.

Tells whether the given Worker is closed on the local node.

Dump internal stat for Worker.

Worker identifier.

Callback implementation for GenServer.init/1.

Updates the worker settings in runtime. Just a subset of the worker settings can be updated. https://mediasoup.org/documentation/v3/mediasoup/api/#worker-updateSettings

Types

create_option()

@type create_option() ::
  %{
    optional(:logLevel) => log_level(),
    optional(:logTags) => [log_tag()],
    optional(:rtcMinPort) => integer(),
    optional(:rtcMaxPort) => integer(),
    optional(:dtlsCertificateFile) => String.t(),
    optional(:dtlsPrivateKeyFile) => String.t()
  }
  | Mediasoup.Worker.Settings.t()

event_type()

@type event_type() :: :on_close | :on_dead

log_level()

@type log_level() :: :debug | :warn | :error | :none

log_tag()

@type log_tag() ::
  :info
  | :ice
  | :dtls
  | :rtp
  | :srtp
  | :rtcp
  | :rtx
  | :bwe
  | :score
  | :simulcast
  | :svc
  | :sctp
  | :message

t()

@type t() :: pid()

update_option()

@type update_option() ::
  %{optional(:logLevel) => log_level(), optional(:logTags) => [log_tag()]}
  | Mediasoup.Worker.UpdateableSettings.t()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(pid)

Closes the worker.

closed?(pid)

@spec closed?(t()) :: boolean()

Tells whether the given Worker is closed on the local node.

create_router(pid, option)

@spec create_router(t(), Mediasoup.Router.create_option()) ::
  {:ok, Mediasoup.Router.t()} | {:error}

Creates a new router. https://mediasoup.org/documentation/v3/mediasoup/api/#worker-createRouter

create_webrtc_server(pid, option)

Creates a new WebRTC server. https://mediasoup.org/documentation/v3/mediasoup/api/#worker-createWebRtcServer

dump(pid)

@spec dump(t()) :: map()

Dump internal stat for Worker.

event(pid, listener, event_types \\ [:on_close, :on_dead])

@spec event(t(), pid(), event_types :: [event_type()]) ::
  {:ok} | {:error, :terminated}

Starts observing event.

id(pid)

Worker identifier.

init(settings)

Callback implementation for GenServer.init/1.

start_link(opt \\ [])

@spec start_link([start_link_opt()]) :: :ignore | {:error, any()} | {:ok, pid()}

update_settings(pid, settings)

@spec update_settings(t(), update_option()) :: {:ok} | {:error}

Updates the worker settings in runtime. Just a subset of the worker settings can be updated. https://mediasoup.org/documentation/v3/mediasoup/api/#worker-updateSettings

worker_count()

@spec worker_count() :: non_neg_integer()