Open ferenc-a opened 1 month ago
@ferenc-a, what is your use case? Curious which approach may be more useful.
I'd like to parse the messages, modify them, and conditionally inject more inbetween them.
Ok, just pushed a commit for this. Would this work for your purposes? Can you try it out?
I'm going on vacation soon, so it might be more than a week until I can try it sorry.
The code looks promising for modifying a message. However, I also want to inject new messages, not just modify existing ones. (Like the equivalent of inject.websocket
here: https://docs.mitmproxy.org/stable/addons-examples/#websocket-inject-message).
It's possible to intercept the HTTP to WebSocket upgrade message (https://github.com/twitchax/AspNetCore.Proxy/issues/27#issuecomment-2371760613), but not the traffic afterwards. It would be nice to have the functionality (like for example, here: https://github.com/joeferner/node-http-mitm-proxy/tree/master?tab=readme-ov-file#proxy_onWebSocketConnection). If full support would take too much, at least the WebSocket made by the library should be exposed, or there should be another callback that is provided to library users where they can access it momentarily, before it's fully initialized.