MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / connect

Method connect

web/src/js/backends/websocket.tsx:61–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 }
60
61 connect() {
62 this.socket = new WebSocket(
63 location.origin.replace("http", "ws") +
64 location.pathname.replace(/\/$/, "") +
65 "/updates",
66 );
67 this.socket.addEventListener("open", () => this.onOpen());
68 this.socket.addEventListener("close", (event) => this.onClose(event));
69 this.socket.addEventListener("message", (msg) =>
70 this.onMessage(JSON.parse(msg.data)),
71 );
72 this.socket.addEventListener("error", (error) => this.onError(error));
73 }
74
75 async onOpen() {
76 // Send all queued messages.

Callers 1

constructorMethod · 0.95

Calls 7

onOpenMethod · 0.95
onCloseMethod · 0.95
onMessageMethod · 0.95
onErrorMethod · 0.95
addEventListenerMethod · 0.80
replaceMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected