Comments (11)
@calvincestari Thank you for all the help
from apollo-ios.
Hi @BraveEvidence - try using the ws
protocol instead of wss
for the websocket server address. It's unlikely your local host is serving WebSocket Secure which would be like using https
locally.
from apollo-ios.
Thank you @calvincestari for your reply. I tried changing the protocol to ws
and now I get error saying "The operation couldn’t be completed. (ApolloWebSocket.WebSocket.WSError error 1.)"
Any suggestions
from apollo-ios.
Check that you're using the correct GraphQL WebSocket subprotocol for your server.
from apollo-ios.
@calvincestari I am using graphql-ws protocol. The subscriptions works fine on Android with Apollo Kotlin
from apollo-ios.
You still need to make sure you're selecting the correct protocol when initializing the websocket. If you're already doing that then you'll need to do some more debugging on your side to determine what else could be wrong; is there anything else in the logs besides the WSError
?
from apollo-ios.
No other logs
from apollo-ios.
If you can replicate this in a sample client then I can try with a websocket service locally to see if anything else if incorrect in the client. It's difficult to debug from that single error response.
from apollo-ios.
Can you check my sample repo over here
from apollo-ios.
I just took a look at the project now and I think you are using the wrong websocket subprotocol. In the Network.swift
file you're using the .graphql_ws
protocol. Note that the initializer requires you to specify the name of the subprotocol and not the name of the library.
I am using graphql-ws protocol. The subscriptions works fine on Android with Apollo Kotlin
graphql-ws is the name of the library but the protocol that it uses is graphql-transport-ws
. You can see this in the first line of the Communication heading in that protocol document you linked to.
The WebSocket sub-protocol for this specification is:
graphql-transport-ws
.
This is confusing because the two packages have terrible library names that are too similar to the subprotocol names. The WSProtocol
enum in the Apollo iOS documentation has details about which is supported by which library.
Change the subprotocol in the Network.swift
file to .graphql_transport_ws
and I think it should work for you.
from apollo-ios.
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.
from apollo-ios.
Related Issues (20)
- Variables Inside Fragments behaving oddly? HOT 14
- Invalid HTTP upgrade spams the log instead of returning an error HOT 10
- `asXXXXXXX` property on a union never returning `nil` if selection set empty HOT 4
- Cache mutations are somewhat painful to work with HOT 5
- Add PrivacyManifest HOT 1
- Can't Use 2 Different Schemas in same Package HOT 2
- `SelectionSet` Generated Initializers Don't Compile with `self` Parameter HOT 5
- When using apollo-ios-pagination, there is an issue where data is not accurately updated when mutations occur. HOT 1
- Xcode Install CLI fails for versions >=1.8 HOT 10
- Test Issue HOT 1
- Testing author_association
- Process Mutation on a Queue when encountering network errors HOT 2
- WebSocketTransport: detect server side completion message. HOT 4
- Invalid type aliases generated on recursive types HOT 1
- Cannot convert value of type 'GraphQLNullable<[String]>' to expected argument type '[String?]' HOT 10
- SchemaConfiguration.cacheKeyInfo(for:object:) never called? HOT 5
- Watcher not firing after failure to decode response HOT 2
- Cococapods installation should use download script to fetch CLI instead of using embedded binary
- How to know subscription state HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-ios.