pyrtma.web_manager.RTMAWebSocketHandler

class RTMAWebSocketHandler(socket, addr, server)[source]

Bases: WebSocketHandler

RTMA Web Socket Handler class

RTMA Web Socket Handler

Initializes and handles RTMA Proxy connection

Parameters:
  • socket – socket object

  • addr – client address

  • server – server object

Methods

calculate_response_key

finish

Close RTMA connection

handle

Handle RTMA proxy connection

handle_connect

handshake

make_handshake_response

pong_received

Log that pong was received

process_json_message

Process incoming json message

read_bytes

read_http_headers

read_next_message

read_ws_message

Read websocket message

send_close

Send CLOSE to client

send_failed_message

Send FAILED_MESSAGE when we cannot forward to websocket

send_message

send_pong

send_text

Important: Fragmented(=continuation) messages are not supported since their usage cases are limited - when we don't know the payload length.

setup

Attributes

disable_nagle_algorithm

rbufsize

timeout

wbufsize

ws_ready_to_send

finish()[source]

Close RTMA connection

handle()[source]

Handle RTMA proxy connection

pong_received(msg)[source]

Log that pong was received

Parameters:

msg (str) – Ignored

process_json_message(message)[source]

Process incoming json message

Called when a client receives a message over websocket

Parameters:

message (str) – JSON message string

read_ws_message()[source]

Read websocket message

Returns:

Websocket message string

Return type:

Optional[str]

send_close(status=1000, reason=b'')

Send CLOSE to client

Parameters:
send_failed_message(header, time_of_failure)[source]

Send FAILED_MESSAGE when we cannot forward to websocket

Parameters:
send_text(message, opcode=1)

Important: Fragmented(=continuation) messages are not supported since their usage cases are limited - when we don’t know the payload length.