proxy.http.websocket.client module#

proxy.py#

⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.

copyright
  1. 2013-present by Abhinav Singh and contributors.

license

BSD, see LICENSE for more details.

class proxy.http.websocket.client.WebsocketClient(hostname: bytes, port: int, path: bytes = b'/', on_message: Optional[Callable[[proxy.http.websocket.frame.WebsocketFrame], None]] = None)[source]#

Bases: proxy.core.connection.connection.TcpConnection

Websocket client connection.

TODO: Make me compatible with the work framework.

_abc_impl = <_abc._abc_data object>#
_reusable: bool#
buffer: List[memoryview]#
closed: bool#
property connection: Union[ssl.SSLSocket, socket.socket]#

Must return the socket connection to use in this class.

handshake() None[source]#

Start websocket upgrade & handshake protocol

hostname: bytes#
on_message: Optional[Callable[[WebsocketFrame], None]]#
path: bytes#
port: int#
run() None[source]#
run_once() bool[source]#
selector: selectors.DefaultSelector#
shutdown(_data: Optional[bytes] = None) None[source]#

Closes connection with the server.

sock: socket.socket#
tag: str#
upgrade() None[source]#

Creates a key and sends websocket handshake packet to upstream. Receives response from the server and asserts that websocket accept header is valid in the response.