Mediasoup.EventListener (mediasoup_elixir v0.16.0)

View Source

Event listener module for rustler because rustler(nif) can only use local pid. This module is used to add, remove, and send events to the listener.

Summary

Functions

Add a listener to the event listener. If the listener is already added, the event types will be updated. If the listener is not added, a monitor will be created and the listener will be added. The calling process handles the :DOWN message and calls remove

Remove a listener from the event listener. If the listener is not added, do nothing. If the listener is added, the monitor will be removed and the listener will be removed. The calling process handles the :DOWN message and calls remove

Types

t()

@type t() :: %Mediasoup.EventListener{
  listeners: %{
    required(pid()) => %{
      event_types: [atom()],
      monitor_ref: reference(),
      tag: any()
    }
  }
}

Functions

add(event_listener, listener, event_types)

Add a listener to the event listener. If the listener is already added, the event types will be updated. If the listener is not added, a monitor will be created and the listener will be added. The calling process handles the :DOWN message and calls remove

new()

remove(event_listener, listener)

Remove a listener from the event listener. If the listener is not added, do nothing. If the listener is added, the monitor will be removed and the listener will be removed. The calling process handles the :DOWN message and calls remove

send(event_listener, event_name, message)