# `Mediasoup.Router`
[🔗](https://github.com/oviceinc/mediasoup-elixir/blob/main/lib/router.ex#L1)

https://mediasoup.org/documentation/v3/mediasoup/api/#Router

# `create_option`

```elixir
@type create_option() :: Mediasoup.Router.Options.t() | map()
```

# `event_type`

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

# `media_codec`

```elixir
@type media_codec() :: %{
  :kind =&gt; :audio | :video | String.t(),
  :mimeType =&gt; String.t(),
  :clockRate =&gt; integer(),
  :channels =&gt; integer(),
  :parameters =&gt; map(),
  :rtcpFeedback =&gt; [map()],
  optional(:payloadType) =&gt; integer(),
  optional(:preferredPayloadType) =&gt; integer()
}
```

# `rtpCapabilities`

```elixir
@type rtpCapabilities() :: any()
```

# `t`

```elixir
@type t() :: %Mediasoup.Router{id: String.t(), pid: pid()}
```

# `can_consume?`

```elixir
@spec can_consume?(t(), String.t(), rtpCapabilities()) :: boolean()
```

Whether the given RTP capabilities are valid to consume the given producer.
https://mediasoup.org/documentation/v3/mediasoup/api/#router-canConsume

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `close`

```elixir
@spec close(t()) :: :ok
```

  Closes the router.

# `closed?`

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

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

# `create_pipe_transport`

```elixir
@spec create_pipe_transport(
  t(),
  Mediasoup.PipeTransport.Options.t()
) :: {:ok, Mediasoup.PipeTransport.t()} | {:error, String.t()}
```

Creates a new pipe transport.
https://mediasoup.org/documentation/v3/mediasoup/api/#router-createPipeTransport

# `create_plain_transport`

```elixir
@spec create_plain_transport(t(), Mediasoup.PlainTransport.create_option()) ::
  {:ok, Mediasoup.PlainTransport.t()} | {:error, String.t()}
```

Creates a new webrtc transport.
https://mediasoup.org/documentation/v3/mediasoup/api/#router-createPlainTransport

# `create_webrtc_transport`

```elixir
@spec create_webrtc_transport(t(), Mediasoup.WebRtcTransport.create_option()) ::
  {:ok, Mediasoup.WebRtcTransport.t()} | {:error, String.t()}
```

Creates a new webrtc transport.
https://mediasoup.org/documentation/v3/mediasoup/api/#router-createWebRtcTransport

# `dump`

```elixir
@spec dump(t()) :: map() | {:error}
```

Dump internal stat for Router.

# `event`

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

Starts observing event.

# `id`

```elixir
@spec id(t()) :: String.t()
```

Router identifier.

# `pipe_data_producer_to_router`

```elixir
@spec pipe_data_producer_to_router(
  t(),
  data_producer_id :: String.t(),
  Mediasoup.Router.PipeToRouterOptions.t()
) :: {:ok, Mediasoup.Router.PipeToRouterResult.t()} | {:error, String.t()}
```

Pipes the given data producer into another router.
https://mediasoup.org/documentation/v3/mediasoup/api/#router-pipeToRouter

# `pipe_producer_to_router`

```elixir
@spec pipe_producer_to_router(
  t(),
  producer_id :: String.t(),
  Mediasoup.Router.PipeToRouterOptions.t()
) ::
  {:ok, Mediasoup.Router.PipeToRouterResult.t()} | {:error, String.t()}
```

Pipes the given media producer into another router.
https://mediasoup.org/documentation/v3/mediasoup/api/#router-pipeToRouter

# `rtp_capabilities`

```elixir
@spec rtp_capabilities(t()) :: rtpCapabilities()
```

An Object with the RTP capabilities of the router.
https://mediasoup.org/documentation/v3/mediasoup/api/#router-rtpCapabilities

# `start_link`

# `struct_from_pid`

```elixir
@spec struct_from_pid(pid()) :: t()
```

# `struct_from_pid_and_ref`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
