davidstump / SwiftPhoenixClient

Connect your Phoenix and iOS applications through WebSockets!
MIT License
507 stars 147 forks source link

Can't use SPM depdency with Apollo, because Apollo requires Starscream >= 4.0, and SPC <4.0 #184

Closed JetForMe closed 2 years ago

JetForMe commented 3 years ago

I can't use this with Apollo, because Apollo requires Starscream >= 4.0, and SPC <4.0. I was hoping SwiftPhoenixClient 2.0 would update to the more recent Starscream, but alas it does not. Any chance of that happening?

Here's the error I get when I try to use SPM for both SPC and Apollo:

Dependencies could not be resolved because root depends on 'SwiftPhoenixClient' 1.3.0..<2.0.0 and root depends on 'apollo-ios' 0.43.0..<1.0.0.
'apollo-ios' is incompatible with 'SwiftPhoenixClient' because no versions of 'SwiftPhoenixClient' match the requirement 1.3.1..<2.0.0.
'apollo-ios' is incompatible with 'SwiftPhoenixClient' because 'apollo-ios' >= 0.42.0 depends on 'Starscream' 4.0.4..<4.1.0 and 'SwiftPhoenixClient' 1.3.0 depends on 'Starscream' 3.1.0..<4.0.0.

We were using CocoaPods for Apollo, and that seemed to work, but I'm trying to move away from CocoaPods.

dsrees commented 3 years ago

So I was initially planning on using starscream 4 but ran into issues into how to reports failed connection attempts to the delegate which broke the Client's reconnection strategy so I kept it pinned to 3.x. I also need to provide an update to use RxSwift 6.x so I will probably create a 2.x and 3.x branch that updates dependencies.

I'll take a look over your PR and see if we can't get Starscream 4.x to work

morgz commented 2 years ago

Apollo has since rollback to Starscream 3 after reliability issues

dsrees commented 2 years ago

👍🏼 Thanks @morgz

I'm going to close this issue since I'm also not a fan of how Starscream 4 works with this client. If you're targeting iOS > 13, then SPC comes with a default URLSessionWebSocketTask implementation that avoids using starscream at all.

JetForMe commented 2 years ago

I can try to use the URLSessionWebSocketTask implementation, but if the Package.swift file doesn't provide a way to resolve the Starscream version conflict, I'm not sure what to do.

dsrees commented 2 years ago

It should allow for it. The core client doesn't include starscream.

products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(name: "SwiftPhoenixClient", targets: ["SwiftPhoenixClient"]),
        .library(name: "StarscreamSwiftPhoenixClient", targets: ["StarscreamSwiftPhoenixClient"]),
        .library(name: "RxSwiftPhoenixClient", targets: ["RxSwiftPhoenixClient"]),
    ],

You should be able to just use

.package(url: "https://github.com/davidstump/SwiftPhoenixClient.git", .upToNextMajor(from: "3.0.0"))

and that will exclude starscream from the client