ProxymanApp / Proxyman

Modern. Native. Delightful Web Debugging Proxy for macOS, iOS, and Android ⚡️
https://proxyman.io
5.35k stars 177 forks source link

(Android) CometD Websocket connection is not displayed in Proxyman #2000

Closed gmbett closed 2 months ago

gmbett commented 2 months ago

Hello,

I'm working on an Android project that uses CometD library to establish a web socket connection, this library opens a connection like: wss://domain.com:8443/genesys/cometd

I'm currently trying to view the traffic on a real device, and I can properly see all REST requests, so Proxyman certificate is correctly installed on the device, and the network_security_config.xml is configured to trust the certificate.

But, for some reason, I'm unable to see the web socket traffic (I have a paid license).

Am I missing any settings?

NghiaTranUIT commented 2 months ago

I believe that CometD library doesn't use the Proxy for its WS and WSS, so Proxyman can't capture this request.

I suppose that should find a way to set HTTP Proxy to CometD lib. Maybe it's the one: https://github.com/cometd/cometd/issues/744

gmbett commented 2 months ago

Hey, sorry for my late reply.

I was able to add the Proxy to the HTTPClient used by the web socket and now I can see indeed the requests on Proxyman

 val httpClient = HttpClient().apply {
    proxyConfiguration.proxies.add(HttpProxy(PROXY_HOST, PROXY_PORT))
 }

 val webSocketClient = WebSocketClient(httpClient)
 ...

Thanks for the hint!

NghiaTranUIT commented 2 months ago

Awesome, glad to know it works 👍