Possible usage of URLSession For Greater Portability
On a lark this weekend I was curious to see if it'd be possible to get swiftly ported to Windows. When I pulled the project down I noticed that a bunch of the NIO stuff doesn't seem to work out of the box on Windows (this is likely fixable, but it prompted me to look at what it was being used for).
It seems like it's primarily being used to build an HTTP client and I was wondering if it's feasible/desirable to switch to using URLSession from Foundation to make this a bit more portable. I don't know if there were specific limitations with that framework which prevented it from being chosen, but I figured I'd start the discussion since managing different toolchains on Windows is also quite a pain!
@patrickfreed Do you think this is something we could hide behind HTTPClientWrapper.
Hey, sorry for the late response on this. Our usage of AsyncHTTPClient could definitely be replaced with URLSession, there's no technical requirement for it. I opted to use it in swiftly simply because it provided a friendly and async/await-ready API. Dropping NIO as a dependency might make the binary size smaller too, which would be nice.
Hey, sorry for the late response on this. Our usage of
AsyncHTTPClientcould definitely be replaced withURLSession, there's no technical requirement for it. I opted to use it in swiftly simply because it provided a friendly and async/await-ready API. Dropping NIO as a dependency might make the binary size smaller too, which would be nice.
It won't make the binary any smaller on Linux as you have to include FoundationNetworking instead.
Hey, sorry for the late response on this. Our usage of
AsyncHTTPClientcould definitely be replaced withURLSession, there's no technical requirement for it. I opted to use it in swiftly simply because it provided a friendly and async/await-ready API. Dropping NIO as a dependency might make the binary size smaller too, which would be nice.It won't make the binary any smaller on Linux as you have to include FoundationNetworking instead.
Good points! I mostly was just thinking for cross platform availability, less of binary size :D
We should probably support both and chose one based on which platform we are running on