Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket traffic interception support #121

Open
ferenc-a opened this issue Sep 24, 2024 · 4 comments
Open

WebSocket traffic interception support #121

ferenc-a opened this issue Sep 24, 2024 · 4 comments

Comments

@ferenc-a
Copy link

It's possible to intercept the HTTP to WebSocket upgrade message (#27 (comment)), 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.

@twitchax
Copy link
Owner

@ferenc-a, what is your use case? Curious which approach may be more useful.

@ferenc-a
Copy link
Author

I'd like to parse the messages, modify them, and conditionally inject more inbetween them.

@twitchax
Copy link
Owner

Ok, just pushed a commit for this. Would this work for your purposes? Can you try it out?

@ferenc-a
Copy link
Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants