Events¶
General¶
|
Called once on startup, and whenever options change.
|
|
Called once when the script shuts down, either because it’s been unloaded, or because the proxy itself is shutting down. |
|
Called whenever an event log is added.
|
|
Called once on startup, before any other events. If you return a value from this event, it will replace the current addon. This allows you to, “boot into” an addon implemented as a class instance from the module level. |
|
Called at a regular sub-second interval as long as the addon is executing. |
Connection¶
|
Called when a client initiates a connection to the proxy. Note that a connection can correspond to multiple HTTP requests.
|
|
Called when a client disconnects from the proxy.
|
|
Called whenever layers are switched. You may change which layer will be used by returning a new layer object from this event.
|
|
Called before the proxy initiates a connection to the target server. Note that a connection can correspond to multiple HTTP requests.
|
|
Called when the proxy has closed the server connection.
|
HTTP Events¶
|
Called when we receive an HTTP CONNECT request. Setting a non 2xx response on the flow will return the response to the client abort the connection. CONNECT requests and responses do not generate the usual HTTP handler events. CONNECT requests are only valid in regular and upstream proxy modes.
|
|
Called when a client request has been received.
|
|
Called when the headers of a client request have been received, but before the request body is read.
|
|
Called when the headers of a server response have been received, but before the response body is read.
|
|
Called when a server response has been received.
|
|
Called when a flow error has occurred, e.g. invalid server responses, or interrupted connections. This is distinct from a valid server HTTP error response, which is simply a response with an HTTP error code.
|
WebSocket Events¶
These events are called only after a connection made an HTTP upgrade with “101 Switching Protocols”. No further HTTP-related events after the handshake are issued, only new WebSocket messages are called.
|
Called when a client wants to establish a WebSocket connection. The
WebSocket-specific headers can be manipulated to alter the
handshake. The
|
|
Called when WebSocket connection is established after a successful handshake.
|
|
Called when a WebSocket message is received from the client or server. The
sender and receiver are identifiable. The most recent message will be
|
|
Called when WebSocket connection ends.
|
|
Called when a WebSocket error occurs - e.g. the connection closing unexpectedly.
|
TCP Events¶
These events are called only if the connection is in TCP mode. So, for instance, TCP events are not called for ordinary HTTP/S connections.
|
Called when TCP streaming starts.
|
|
Called when a TCP payload is received from the client or server. The
sender and receiver are identifiable. The most recent message will be
|
|
Called when TCP streaming ends.
|
|
Called when a TCP error occurs - e.g. the connection closing unexpectedly.
|