rtmp v0.2.0 Rtmp.ServerSession.Handler

This module controls the process that processes the business logic of a server in an RTMP connection.

The session handler can react to incoming RTMP input messages from the client by responding directly with RTMP output messages or by sending out event notifications for other processes to react to.

The session handler then has an API for other processes to proactively trigger business logic (such as accepting a connection request) and cause RTMP messages to be sent out to the connected client.

Summary

Functions

Attempts to accept a request with the specified id

Passes an incoming RTMP message to the session handler

Notifies the session handler of new input or output byte totals

Sends a ping request to the connected client

Forms an RTMP detailed message with the specified message contents to be sent to the client

Sends the client the initial RTMP messages allowing the client to send messages on stream id 0

Specifies the process id and function to use to raise event notifications

Specifies the process id and function to send outbound RTMP messages

Starts a new session handler process

Types

event_receiver_module()
event_receiver_module() :: module
event_receiver_process()
event_receiver_process() :: pid
protocol_handler_module()
protocol_handler_module() :: module
request_id()
request_id() :: non_neg_integer
rtmp_output_handler()
rtmp_output_handler() :: pid
session_handler()
session_handler() :: pid

Functions

accept_request(pid, request_id)
accept_request(session_handler, request_id) :: :ok

Attempts to accept a request with the specified id

handle_rtmp_input(pid, detailed_message)

Passes an incoming RTMP message to the session handler

notify_byte_count(pid, atom, total)

Notifies the session handler of new input or output byte totals

send_ping_request(pid)
send_ping_request(session_handler) :: :ok

Sends a ping request to the connected client

send_rtmp_message(pid, message, stream_id, forced_timestamp \\ nil)
send_rtmp_message(session_handler, Rtmp.deserialized_message, non_neg_integer, non_neg_integer | nil) :: :ok

Forms an RTMP detailed message with the specified message contents to be sent to the client

send_stream_zero_begin(pid)
send_stream_zero_begin(session_handler) :: :ok

Sends the client the initial RTMP messages allowing the client to send messages on stream id 0

set_event_handler(session_pid, event_pid, event_receiver_module)
set_event_handler(session_handler, event_receiver_process, event_receiver_module) ::
  :ok |
  :event_handler_already_set

Specifies the process id and function to use to raise event notifications.

It is expected that the module passed in implements the Rtmp.Behaviours.EventReceiver behaviour.

set_rtmp_output_handler(session_pid, protocol_handler_pid, protocol_handler_module)
set_rtmp_output_handler(session_handler, rtmp_output_handler, protocol_handler_module) ::
  :ok |
  :output_handler_already_set

Specifies the process id and function to send outbound RTMP messages

It is expected that the module passed in implements the Rtmp.Behaviours.ProtocolHandler behaviour.

start_link(connection_id, configuration)

Starts a new session handler process