Skip to content
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

⚡ Ignore unknown websocket messages #4066

Merged
merged 3 commits into from
Apr 27, 2022

Conversation

martinbonnin
Copy link
Contributor

  • ignore unknown websocket messages
  • add a test

@netlify
Copy link

netlify bot commented Apr 27, 2022

Deploy Preview for apollo-android-docs canceled.

Name Link
🔨 Latest commit c8e1756
🔍 Latest deploy log https://app.netlify.com/sites/apollo-android-docs/deploys/62694617f693ff000897b627

import com.apollographql.apollo3.network.ws.WebSocketEngine
import okio.ByteString

class FakeWebSocketEngine(val onReceive: suspend () -> String, val onSend: (String) -> Unit) : WebSocketEngine {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be promoted to apollo-testing-support at some point.

Copy link
Contributor

@BoD BoD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

/**
* Parses a WebSocket message containing Json to a Map<String, Any?>
*
* @return the map representing the Json or [null] if the message is not a Json object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of wondering why it happens

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea but looks like it's a good application of the Robustness principle

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@martinbonnin martinbonnin merged commit 7c83db7 into main Apr 27, 2022
@martinbonnin martinbonnin deleted the ignore-unknown-websocket-messages branch April 27, 2022 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants