Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Conversation

@lukmccall
Copy link
Contributor

Why

This PR isn't a ready fix, because I don't really know how this change should be introduced to the CLI.

Fixes expo-cli terminal commands does not recognise the device:

warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.

How

RN 0.67 introduced a different way of handling WebSocket connections. You can read more here -> react-native-community/cli#1560.

TL;DR
WebSockets started using a shared server. They are created with the noServer flag right now and have to be attached to the upgrade event like here https://github.com/websockets/ws#multiple-servers-sharing-a-single-https-server.
However, by doing that we are losing the backwards compatibility.

Test Plan

  • run project with RN 0.68 ✅
  • a project with RN 0.64.X doesn't work with that version of CIL

"@expo/metro-config": "0.3.13",
"@expo/osascript": "2.0.32",
"@react-native-community/cli-server-api": "^5.0.1",
"@react-native-community/cli-server-api": "^7.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

We should drop this dependency and import it from the project if available like we do for metro.

Comment on lines +89 to +95
const {
middleware,
debuggerProxyEndpoint,
messageSocketEndpoint,
eventsSocketEndpoint,
websocketEndpoints,
} = createDevServerMiddleware({
Copy link
Contributor

Choose a reason for hiding this comment

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

We may need to check which features are available based on the version installed and implement the new functionality only when the new features are available. Ultimately we'll drop this in SDK 46 when we drop the unversioned CLI.

@EvanBacon
Copy link
Contributor

Closing in favor of #4306

@EvanBacon EvanBacon closed this Apr 15, 2022
@EvanBacon EvanBacon deleted the @lukmccall/fix-websocket-controlls-on-rn-68 branch April 15, 2022 20:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants