rtmp v0.1.1 Rtmp.ServerSession.Handler

This module controls the process that controls 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

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_notification_process()
event_notification_process() :: pid
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

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_notification_process, event_receiver_module) ::
  :ok |
  :event_handler_already_set

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

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

start_link(connection_id, configuration)

Starts a new session handler process