Apollo-ios: Option to opt-out from re-conecting to WebSocket

Created on 3 Feb 2020  路  5Comments  路  Source: apollographql/apollo-ios

Let me explain why this would be needed.

GraphQL subscriptions connect to the server and all is good, but if it looses connection (network issue or re-deploy of the server) currently WebSocketTransport tries to reconnect. When connection it tries to write to send to the queue but if not _acked_ it saves message to the queue. If this happens multiple times the result is multiple of the same subscription message in the queue.

Next step would be to keep better WebSocket state using IDs from subscription message not just incremented IDs, that would help to avoid duplicate websocekt message instances in the WebSocketTransport.queue.

if this sounds like a feature to add I can come up with a PR.

apollo-websockets

All 5 comments

It seems reasonable - my understanding of the websocket stuff is slightly hand-wavy, but this seems like a reasonable thing to allow opting out of, since the default behavior of trying to reconnect is probably what most people want, but your situation of not wanting it also makes sense.

Would love to see a PR!

@designatednerd I can help out with other stuff with Websockets stuff as I have dealt with that a lot and I help to maintain the Starscream library and wrote some articles about the topic. :)

God that'd be a huge help. I'll ping you off GH and we can chat.

This issue was at least partially addressed by #1004 which shipped with 0.22.0.

@fassko are there still more pieces you want to fix on this before I close it out?

Thanks, for updating Starscream I created #1030 you can assign it to me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hiteshborse12 picture hiteshborse12  路  4Comments

farice picture farice  路  4Comments

ermik picture ermik  路  4Comments

AnthonyMDev picture AnthonyMDev  路  4Comments

marcoreni picture marcoreni  路  3Comments