Best way to use Pulse with Get
Hi @kean,
In my current project we use your library Get.
As we don't use URLSession directly, we can't use a recommended proxy. A delegate way is a no-go for us as well as in Get async methods of URLSession are used. And it seems not straightforward how to use NetworkLogger directly with Get, because we do not have direct access to data task events.
For now we ended up using not recommended .enableProxy() method.
Can you share your thoughts on the best way to integrate Pulse with Get?
Thanks a ton!
Hey, @joliejuly.
TL;DR: the best way is to use Pulse.URLSessionProxyDelegate (aka Option 3). The integration steps are covered in https://github.com/kean/Get?tab=readme-ov-file#pulse.
The Pulse.NetworkLogger.enableProxy() method is totally fine as long as it satisfies your needs and is not used for the App Store builds.
The new Pulse.URLSessionProxy(configuration: .default) API is mainly needed for the scenarios where you use URLSession directly (without Get or other wrappers) as Pulse.URLSessionProxy adds support for native URLSession async/await APIs. Get has its own async/await APIs that internally use traditional URLSession delegate-based APIs, which makes it possible to use it with Pulse.URLSessionProxyDelegate.
I realize that's it's perhaps too many options, but the native SKD doesn't provide any hooks for logging, so you have to jump through hoops.
Hey @kean ! Thanks for letting me know. I wanted to use Option 3, but the docs says it does not work with async/await methods which as I believe are used in Get. But as for now we use Pulse as a debugging tool, we should be fine with enableProxy() method.
does not work with async/await methods which as I believe are used in Get.
Just to reiterate, Get does not in fact use URLSession async/await methods, and is fully supported by Option 3.