react-native: Somewhere between 0.0.55 and 0.0.57, socket.io stops working

Environment

Last working version:

react-native info
Environment:
  OS: macOS Sierra 10.12.6
  Node: 8.10.0
  Yarn: 1.6.0
  npm: 5.6.0
  Watchman: 4.9.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
  react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728
  react-native: 0.55.x => 0.55.4

Broken version:

  React Native Environment Info:
    System:
      OS: macOS Sierra 10.12.6
      CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
      Memory: 228.90 MB / 16.00 GB
      Shell: 5.2 - /bin/zsh
    Binaries:
      Node: 8.10.0 - /usr/local/bin/node
      Yarn: 1.6.0 - /usr/local/bin/yarn
      npm: 5.6.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.2, macOS 10.13, tvOS 11.2, watchOS 4.2
      Android SDK:
        Build Tools: 19.1.0, 23.0.1, 23.0.2, 25.0.2, 26.0.2, 27.0.3, 28.0.0, 28.0.3
        API Levels: 15, 23, 25, 26, 27
    IDEs:
      Android Studio: 3.0 AI-171.4443003
      Xcode: 9.2/9C40b - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728
      react-native: 0.57.x => 0.57.4
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-workers: 0.3.1

Description

Websocket connections time out on 0.0.57. I made an issue in socket.io, but after switching through react-native versions, it’s clearly a react native issue. https://github.com/socketio/socket.io-client/issues/1245 for an example socketio setup.

It doesn’t seem to be the iPhone X simulator, which in 0.0.57 is the default, but in older versions is not. The iPhoneX simulator runs sockets just fine in the older versions.

It might be babel, as it seems there was an upgrade to babel between these versions.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 10
  • Comments: 38 (2 by maintainers)

Most upvoted comments

Tried “socket.io-client”: “2.0.4” it worked for me

In react-native: 0.58.4, problem still remains (I’m using https://github.com/stomp-js/stompjs). The thing, that websocket working only when ‘remote debug’ is on, is driving me crazy 😄 Any workarounds for my case?

I have the same issue. Interestingly, it works fine when you are running your app while debugging remotely, but as soon as you turn off “debug js remotely”, it stops working.

I think this issue should be left open.

Tried “socket.io-client”: “2.0.4” it worked for me

This works very well. Thanks @bgoyal2222

Thanks @bgoyal2222 it’s works with me also. I am using react native “0.56.0”

It’s really horrible spending two days trying to figure out why it’s work with debug remote js and not work without it.

I have the same issue.

Working on 0.55 and not working on 0.56 and 0.57.4 react-native versions

I have opened a bug report for the issue here https://github.com/facebook/metro/issues/365

@doostin When you debug remotely, I believe the JS runs in Chrome’s javascript engine. My guess is the issue lies in the native engine, which is why you’re not seeing it in debug.