-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Websocket error broadcast for unsubscribed ID #506
Conversation
✅ Docs Preview ReadyNo new or changed pages found. |
✅ Deploy Preview for eclectic-pie-88a2ba canceled.
|
✅ Deploy Preview for apollo-ios-docc canceled.
|
@@ -207,11 +218,6 @@ public class WebSocketTransport { | |||
kind: .neitherErrorNorPayloadReceived) | |||
responseHandler(.failure(websocketError)) | |||
} | |||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative approach to silencing this error path is to move unsubscribing IDs into another array that can be checked against if the ID is not found in subscribers
. This would ensure we're discarding a message for an unsubscribing handler but I'm not sold on that being necessary.
The unsubscribing array should be of [String]
type since there would be no need to store the handling closure again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
9d8aafbe fix: Websocket error broadcast for unsubscribed ID (#506) git-subtree-dir: apollo-ios git-subtree-split: 9d8aafbedece7483f397cb3a43f30f95892f840d
…bscribed ID git-subtree-dir: apollo-ios git-subtree-mainline: 05b5699 git-subtree-split: 9d8aafbedece7483f397cb3a43f30f95892f840d
Closes apollographql/apollo-ios#2274
Closes apollographql/apollo-ios#2447
There is a sequence of events where the caller unsubscribes which removes their ID from
subscribers
but an incoming message is then received for that subscriber. It doesn't seem correct to broadcast that as an error to all remaining subscribers for unrelated messages.Changes:
id
field in the messageid
was not found insubscribers
.