twitchax / AspNetCore.Proxy

ASP.NET Core Proxies made easy.
MIT License
525 stars 83 forks source link

WebSocket interception support #27

Closed JakeSmokie closed 4 years ago

JakeSmokie commented 4 years ago

Is there any possible way to intercept websocket requests?

Mostly probable that ProxyOptions.WithIntercept is not supposed to handle this case

twitchax commented 4 years ago

@JakeSmokie, I plan on implementing this. I am in the middle of doing a big redesign, and this feature is on my list of TODOs. At the moment, based on the current design, WebSocket support is kind of a second-class citizen, so I want to address that.

ferenc-a commented 1 week ago

Was this feature actually completed? The function I pass to WsProxyOptionsBuilder.Instance.WithIntercept( only gets called once, on the HTTP connection that upgrades to a WebSocket. I can't actually intercept the traffic on WebSocket after this, and it looks like I can't access the WS connection after calling WsProxyAsync, so I can't even handle it with other tools.

twitchax commented 1 week ago

This particular issue was about intercepting the initial upgrade. At present, there is a TODO for adding interception while the web socket is pumped.

ferenc-a commented 1 week ago

It was not clear for me before, there was no reference to the upgrade here. I made a new issue for it then: https://github.com/twitchax/AspNetCore.Proxy/issues/121. Btw, your link is to some YouTube video, not a code todo.

twitchax commented 1 week ago

Ha, sorry. Fixed.