on_http_request Event
Fires when an HTTP request is received.
Syntax
class AzureRelayReceiverHTTPRequestEventParams(object): @property def connection_id() -> int: ... @property def rendezvous_address() -> str: ... @property def id() -> str: ... @property def request_headers() -> str: ... @property def request_target() -> str: ... @property def request_method() -> str: ... @property def host() -> str: ... @property def remote_address() -> str: ... @property def remote_port() -> int: ... @property def request_data() -> bytes: ... # In class AzureRelayReceiver: @property def on_http_request() -> Callable[[AzureRelayReceiverHTTPRequestEventParams], None]: ... @on_http_request.setter def on_http_request(event_hook: Callable[[AzureRelayReceiverHTTPRequestEventParams], None]) -> None: ...
Remarks
This event fires when an HTTP request is received. The parameters of this event describe the details of the HTTP request.
The ConnectionId value must be saved and used when calling send_http_response.
Parameter Descriptions
ConnectionId contains an identifier generated by the class to identify each connection. This identifier is unique to this connection.
RendezvousAddress holds the rendezvous URL to which the connection specific websocket connection may be made. This is for information only, no action needs to be taken based on this value. For instance: wss://g2-prod-by3-003-sb.servicebus.windows.net/$hc/hc1?sb-hc-action=request&sb-hc-id=e1df5efe-0988-450c-9512-f9f1d91b39a0_G2
Id holds the Id of the connection. If an Id was specified by the client it is present here, otherwise the Azure Relay service generates a value. For instance: 2d4acb89-7d15-4aeb-bcd5-66e031580a90_G21_G1.
RequestHeaders contains a JSON object containing the HTTP headers supplied to the Azure Relay service by the sender. Note that authorization values used to authenticate to the Azure Relay service, as well as all headers defined in RFC 7230 with the exception of Via are also stripped. For instance headers such as Content-Length are stripped by the relay and are not present in this value. For instance:
"requestHeaders": {
"Accept-Encoding": "gzip, deflate",
"Host": "nstest.servicebus.windows.net",
"User-Agent": "IPWorks HTTP Component - www.nsoftware.com",
"Via": "1.1 nstest.servicebus.windows.net"
}
RequestTarget is the request target including query string params, as defined in RFC 7230 section 5.3. For instance /hc1.
RequestMethod contains HTTP method sent in the request. For instance POST or GET.
Hostholds the Host header value of the connected client.
RemoteHost contains the IP address of the remote host that initiated the HTTP request (the client).
RemotePort contains the port used by the remote host to establish the connection.
RequestData holds the body of the HTTP request (if any).