MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / websocket_message

Function websocket_message

examples/addons/websocket-inject-message.py:15–22  ·  view source on GitHub ↗
(flow: http.HTTPFlow)

Source from the content-addressed store, hash-verified

13
14
15def websocket_message(flow: http.HTTPFlow):
16 assert flow.websocket is not None # make type checker happy
17 last_message = flow.websocket.messages[-1]
18 if last_message.is_text and "secret" in last_message.text:
19 last_message.drop()
20 ctx.master.commands.call(
21 "inject.websocket", flow, last_message.from_client, b"ssssssh"
22 )
23
24
25# Complex example: Schedule a periodic timer

Callers

nothing calls this directly

Calls 2

dropMethod · 0.80
callMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…