Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible usage of URLSession For Greater Portability #80

Open
brianmichel opened this issue Oct 15, 2023 · 5 comments
Open

Possible usage of URLSession For Greater Portability #80

brianmichel opened this issue Oct 15, 2023 · 5 comments

Comments

@brianmichel
Copy link

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!

@adam-fowler
Copy link
Member

@patrickfreed Do you think this is something we could hide behind HTTPClientWrapper.

@patrickfreed
Copy link
Collaborator

patrickfreed commented Nov 3, 2023

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.

@adam-fowler
Copy link
Member

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.

It won't make the binary any smaller on Linux as you have to include FoundationNetworking instead.

@brianmichel
Copy link
Author

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.

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

@adam-fowler
Copy link
Member

We should probably support both and chose one based on which platform we are running on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants