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

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

# `connect_option`

```elixir
@type connect_option() :: %{
  :ip =&gt; String.t(),
  :port =&gt; integer(),
  optional(:srtpParameters) =&gt; srtp_parameters_t() | nil
}
```

# `event_type`

```elixir
@type event_type() :: :on_close | :on_sctp_state_change | :on_tuple
```

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

# `sctp_parameters_t`

```elixir
@type sctp_parameters_t() :: map()
```

https://mediasoup.org/documentation/v3/mediasoup/sctp-parameters/#SctpParameters

# `srtp_parameters_t`

```elixir
@type srtp_parameters_t() :: map()
```

https://mediasoup.org/documentation/v3/mediasoup/srtp-parameters/#SrtpParameters

# `t`

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

# `transport_stat`

```elixir
@type transport_stat() :: map()
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `close`

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

Closes the PipeTransport.

# `closed?`

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

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

# `connect`

```elixir
@spec connect(t(), option :: connect_option()) ::
  {:ok} | {:error, String.t() | :terminated}
```

Provides the pipe RTP transport with the remote parameters.
https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-connect

# `consume`

```elixir
@spec consume(t(), Mediasoup.Consumer.Options.t() | map()) ::
  {:ok, Mediasoup.Consumer.t()} | {:error, String.t() | :terminated}
```

Instructs the router to send audio or video RTP (or SRTP depending on the transport class). This is the way to extract media from mediasoup.
https://mediasoup.org/documentation/v3/mediasoup/api/#transport-consume

# `consume_data`

```elixir
@spec consume_data(t(), Mediasoup.DataConsumer.Options.t() | map()) ::
  {:ok, Mediasoup.DataConsumer.t()} | {:error, String.t() | :terminated}
```

Instructs the router to send data messages to the endpoint via SCTP protocol or directly to the Rust process if the transport is a DirectTransport.
https://mediasoup.org/documentation/v3/mediasoup/api/#transport-consumedata

# `dump`

```elixir
@spec dump(t()) :: any() | {:error, :terminated}
```

Dump internal stat for PipeTransport.

# `event`

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

Starts observing event.

# `get_stats`

```elixir
@spec get_stats(t()) :: [transport_stat()] | {:error, :terminated}
```

Returns current RTC statistics of the pipe transport.
https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-getStats

# `id`

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

PipeTransport identifier.

# `produce`

```elixir
@spec produce(t(), Mediasoup.Producer.Options.t() | map()) ::
  {:ok, Mediasoup.Producer.t()} | {:error, String.t() | :terminated}
```

Instructs the router to receive audio or video RTP (or SRTP depending on the transport class). This is the way to inject media into mediasoup.
https://mediasoup.org/documentation/v3/mediasoup/api/#transport-produce

# `produce_data`

```elixir
@spec produce_data(t(), Mediasoup.DataProducer.Options.t() | map()) ::
  {:ok, Mediasoup.DataProducer.t()} | {:error, String.t() | :terminated}
```

Instructs the router to receive data messages. Those messages can be delivered by an endpoint via SCTP protocol or can be directly sent from the Node.js application if the transport is a DirectTransport.
https://mediasoup.org/documentation/v3/mediasoup/api/#transport-producedata

# `sctp_parameters`

```elixir
@spec sctp_parameters(t()) :: sctp_parameters_t() | {:error, :terminated}
```

Local SCTP parameters. Or undefined if SCTP is not enabled.
https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-sctpParameters

# `sctp_state`

```elixir
@spec sctp_state(t()) :: String.t() | {:error, :terminated}
```

Current SCTP state. Or undefined if SCTP is not enabled.
https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-sctpState

# `srtp_parameters`

```elixir
@spec srtp_parameters(t()) :: srtp_parameters_t() | {:error, :terminated}
```

Local SRTP parameters representing the crypto suite and key material used to encrypt sending RTP and SRTP.
Those parameters must be given to the paired pipeTransport in the connect() method.
https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-srtpParameters

# `start_link`

# `struct_from_pid`

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

# `struct_from_pid_and_ref`

# `tuple`

```elixir
@spec tuple(t()) :: TransportTuple.t() | {:error, :terminated}
```

The transport tuple. It refers to both RTP and RTCP since pipe transports use RTCP-mux by design.
https://mediasoup.org/documentation/v3/mediasoup/api/#pipeTransport-tuple

---

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