Open BadPirate opened 1 month ago
Thanks for the report. Officially, Apollo iOS does not currently support Linux or server-side use cases. That said, if there is a simple way to make this work for your use case, we are open to a pull request to unblock you.
We aren't rejecting this issue, but it's not a high-priority for us right now. If you'd like to see this move forward, please consider making a PR yourself. Thank you!
@AnthonyMDev - Thanks! Yeah, chugging along here, seems that beyond some slight changes to URLSession (to use the FoundationNetwork stuff), the bigger issue is ApolloWebSocket, which relies on a few non-ported foundation libraries.
I've resolved zlib, and CommonCrypto here - https://github.com/BadPirate/apollo-ios/tree/badpirate/3410-FoundationNetworking (roughly, not ready for a PR, and might actually have some side effects even if it builds on Mac)
But the big holdout now seems to be SSL support :/ -- There doesn't seem to be a drop-in replacement for Apple's SSL stuff (nor would you want to make one as it's pretty long in the tooth) -- I think if I want web socket support (which I do) I'm going to have to re-implement using swift-nio or something. Do you see any lighter way to accomplish this?
@BadPirate We are planning on dropping support for some older iOS versions in the 2.0 version (currently in development). This should make it easier for us to then fix some of the SSL and web socket code. But it's still likely going to be a pretty big lift to re-implement WebSockets.
I do think you'll need to do some custom implementation for WebSockets, but I'd be interested in any work you're doing for linux support in the other areas for the 2.0 release. Would love to chat more about that and see a PR once I've got the 2.0 branch stable.
Yeah, I'm trying to use ApolloClient with a server (and importantly subscriptions), perhaps being too clever, but I'm hoping to use server that has a subscription to a particular query on the DB as a "worker". At the moment I'm focused on getting it to work and running with Mac hardware, but very likely will be making a transition to linux once that is done, Apollo being the biggest hurdle, probably in a few months. I'll circle back then when I'm cracking on it.
Side note, I did an experiment to do the same thing (Apollo Client from server) using node / typescript -- and decided not to go that route as I want to have strictly typed code generated query results, and best I can tell the ApolloLink stuff only has that for React.
Use case
Currently swift-corelibs-foundation (used for server iOS apps like Vapor) is using FoundationNetworking instead of Foundation for URLSession. Might be as simple as importing FoundationNetworking if canImport. Currently, Apollo fails to compile with warnings that URLSession has moved when trying to compile under Vapor Buildpack.
Repro, try to compile a target that imports apollo-ios package using Vapor Buildpack
(and many more)
Describe the solution you'd like
Looking into a conditional import of the framework to see if that's enough to fix it. Might be that there are incompatibilities as well.