ProxymanApp / atlantis

Capture HTTP/HTTPS, and Websocket from iOS app without proxy.
https://proxyman.io
Apache License 2.0
1.25k stars 93 forks source link

Swizzle URLSession Metrics #61

Open Sherlouk opened 3 years ago

Sherlouk commented 3 years ago

Hey! Got a bit of a feature request here 🤓

How would you feel about swizzling this request: urlSession(_:task:didFinishCollecting:)

This is a really interesting delegate call because it gives you access to the task metrics which includes how long every part of the request took including the DNS lookup, connection, and of course the server response time.

image

It also provides more information about the request itself including the remote server details, the protocol used and whether it was on a cellular network or not.

All of this data feels useful not only for Atlantis but Proxyman too as it provides a much richer understanding of the time taken to make requests.

Sherlouk commented 3 years ago

Worth noting, some (most?) is only available on iOS 13+ (etc) - so should just be a nil object on incompatible versions rather than bumping the package's minimum up.

NghiaTranUIT commented 3 years ago

Thanks for opening this ticket @Sherlouk

I suppose that I should support your request soon and show the data in the Summary Tab on Proxyman macOS 😄

Screen Shot 2021-02-28 at 08 53 26

I will put this feature in the next release 🎉

dioKaratzas commented 1 year ago

@NghiaTranUIT Any progress on that?

NghiaTranUIT commented 1 year ago

Hey @dnKaratzas, I haven't worked on it yet. Which timing elements that you concerned?

dioKaratzas commented 1 year ago

@NghiaTranUIT I am working on an In-App request browser by using Atlantis Delegate to grab the TrafficPackages. I want to get the Request/Response headers/body size. It would be nice if we can get the Metrics from the urlSession(_:task:didFinishCollecting:). Tried to swizzle that method but seems more complicated than the others