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
Close RTMA connection
Handle RTMA proxy connection
handle_connect
handshake
make_handshake_response
Log that pong was received
Process incoming json message
read_bytes
read_http_headers
read_next_message
Read websocket message
Send CLOSE to client
Send FAILED_MESSAGE when we cannot forward to websocket
send_message
send_pong
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
- 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:
status – Status as defined in https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1
reason – Text with reason of closing the connection
- send_failed_message(header, time_of_failure)[source]
Send FAILED_MESSAGE when we cannot forward to websocket
- Parameters:
header (MessageHeader) –
time_of_failure (float) –
- 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.