apollo-ios: updateConnectingPayload disconnects the web socket connection and doesn't restart it
Bug report
I have code that calls updateConnectingPayload(...)
on the web socket to update the connection params. It always seems to disconnect the web socket and then I can’t restart it.
Versions
Please fill in the versions you’re currently using:
apollo-ios
SDK version: 1.0.3- Xcode version: 14.1
- Swift version: 5.7
- Package manager: SPM
Steps to reproduce
print(webSocketTransport.isConnected()) // Returns true
webSocketTransport.updateConnectingPayload(authPayload, reconnectIfConnected: true)
print(webSocketTransport.isConnected()) // Returns false (I would expect this to return true)
If the web socket has not been started this code works fine. Otherwise, it disconnects the web socket and prints the error “websocket is disconnected”.
How do I get the websocket to reconnect?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 15 (7 by maintainers)
Haha yeah it’s not ideal, but my understanding is
Task.sleep
is non blocking and it’s not on the main thread, so I wouldn’t think it would cause too many issues.It’s really a short term fix until v2. But, I agree a completion block would be better code.
As side note, for my convenience I actually wrapped most of the Apollo API in async/await code, so hopefully it will be easy to move to v2 when that happens!