View Source Membrane.RTMP.Source.TcpServer (Membrane RTMP plugin v0.23.3)

A simple tcp server, which handles each new incoming connection.

The socket_handler function passed inside the options should take the socket returned by :gen_tcp.accept/1 and return {:ok, pid}, where the pid describes a process, which will be interacting with the socket. The process will be temporarily linked with a Membrane.RTMP.Source.TcpServer worker process until it successfully grants it the control over the socket using :gen_tcp.controlling_process/2.

Summary

Types

t()

Defines options for the TCP server. The listen_options are passed to the :gen_tcp.listen/2 function. The socket_handler is a function that takes socket returned by :gen_tcp.accept/1 and returns the pid of a process, which will be interacting with the socket.

Functions

Returns a specification to start this module under a supervisor.

Types

@type t() :: %Membrane.RTMP.Source.TcpServer{
  listen_options: [:inet.inet_backend() | :gen_tcp.listen_option()],
  parent: pid(),
  port: :inet.port_number(),
  socket_handler:
    (:gen_tcp.socket() -> {:ok, pid()} | {:error, reason :: any()})
}

Defines options for the TCP server. The listen_options are passed to the :gen_tcp.listen/2 function. The socket_handler is a function that takes socket returned by :gen_tcp.accept/1 and returns the pid of a process, which will be interacting with the socket.

Functions

Returns a specification to start this module under a supervisor.

arg is passed as the argument to Task.start_link/1 in the :start field of the spec.

For more information, see the Supervisor module, the Supervisor.child_spec/2 function and the Supervisor.child_spec/0 type.

@spec run(t()) :: no_return()
@spec start_link(t()) :: {:ok, pid()}