pyrtma.web_manager.RTMAWebSocketHandler
- class RTMAWebSocketHandler(socket, addr, server)[source]
Bases:
WebSocketHandlerRTMA 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_keyClose RTMA connection
Handle RTMA proxy connection
handle_connecthandle_connect_v2handshakemake_handshake_responseLog that pong was received
Process incoming json message
read_bytesread_http_headersread_next_messageRead websocket message
Send CLOSE to client
Send FAILED_MESSAGE when we cannot forward to websocket
send_messagesend_pongImportant: Fragmented(=continuation) messages are not supported since their usage cases are limited - when we don't know the payload length.
setupAttributes
disable_nagle_algorithmrbufsizetimeoutwbufsizews_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
- 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.