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

Introduce incubating WebSocketNetworkTransport #5678

Merged
merged 5 commits into from Mar 5, 2024

Conversation

martinbonnin
Copy link
Contributor

@martinbonnin martinbonnin commented Mar 4, 2024

This PR introduces an incubating WebSocketNetwork. Disclaimer: this is 100% untested. It's not finished yet but it's relatively self contained so I'm making a separate PR.

This PR introduces incubating:

  • WebSocketNetworkTransport: a NetworkTransport that is a lot more simple than the non-incubating one. The execute() method in particular is just a callbackFlow
  • WebSocketHolder: a class responsible to hold the websocket
  • SubscribableWebSocket: the glue between WebSocket and WsProtocol. This is where most of the state machine is
  • WsProtocol and implementations for AppSync, GraphqlWs, etc.. This is mostly unchanged from the non-incubating version.

Missing:

  • retry logic (~= reopenWhen)
  • suspend serverUrl and headers for AppSync or other clients that want to change the server url
  • connectivity indicators (is my socket connected?)
  • shared okhttp client
  • lots of tests

@martinbonnin martinbonnin force-pushed the 04-websocket-network-transport branch from 3386922 to 3035a9a Compare March 4, 2024 14:33
@martinbonnin martinbonnin changed the title Introduce WebSocketNetworkTransport Introduce incubating WebSocketNetworkTransport Mar 4, 2024
@martinbonnin martinbonnin marked this pull request as ready for review March 4, 2024 15:37
@martinbonnin martinbonnin requested a review from BoD as a code owner March 4, 2024 15:37
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.

Base automatically changed from 03-introduce-incubating-websocket-engine to main March 5, 2024 09:21
@martinbonnin martinbonnin force-pushed the 04-websocket-network-transport branch from 1e13985 to eb4e6f4 Compare March 5, 2024 09:22
Copy link

netlify bot commented Mar 5, 2024

Deploy Preview for apollo-android-docs canceled.

Name Link
🔨 Latest commit eb4e6f4
🔍 Latest deploy log https://app.netlify.com/sites/apollo-android-docs/deploys/65e6e458ace974000820aac7

@martinbonnin martinbonnin merged commit 3221a8b into main Mar 5, 2024
8 of 9 checks passed
@martinbonnin martinbonnin deleted the 04-websocket-network-transport branch March 5, 2024 09:23
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.

None yet

2 participants