Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native endless stream of Socket SO_ERROR

I'm working on an existing React Native project and in XCode log output I get an endless stream of the following errors

2019-01-09 12:15:49.005630+0000 App [13746:3543026] [] nw_socket_handle_socket_event [C10.1:1] Socket SO_ERROR [61: Connection refused]
2019-01-09 12:15:49.016640+0000 App [13746:3543026] [] nw_socket_handle_socket_event [C10.2:1] Socket SO_ERROR [61: Connection refused]
2019-01-09 12:15:49.017800+0000 App [13746:3543010] [] nw_connection_get_connected_socket [C10] Client called nw_connection_get_connected_socket on unconnected nw_connection

How could I go about figuring out where this error is coming from? It doesn't seem to be affecting the app, but I would like to understand the issue. I suspect it's not the app's JavaScript code, but one of the pods being used:

pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/Crash'
like image 511
Karolis Avatar asked Jan 09 '19 12:01

Karolis


People also ask

Is it possible to use plain WebSocket server with React Native?

I heard that Socket.io not worked properly in React Native, so I decided to use plain WebSocket instead. I'm using node.js for implemeting WebSocket server, and it wasn't hard. With browsers, all of I tried worked, but with React native, none of success.

What to say when something goes wrong in React Native?

Sorry, something went wrong. Sorry, something went wrong. Sorry, something went wrong. Sorry, something went wrong. Sorry, something went wrong. Sorry, something went wrong. This should be fixed in the latest react-native.

Why is my rctwebsocketexecutor not working?

If you are running on the device, check if you have the right IP address in RCTWebSocketExecutor.m. I noticed that this issue occurred when I switched between two different networks (call them A and B). When running on network B, the IP address in the message above was from network A.


1 Answers

  1. To select XCode10 build system: In Xcode go to File -> Project Settings (or Workspace settings) -> Build system, in which change the New Build System to Legacy Build System.

enter image description here

  1. Temporary fix: Edit Scheme => Run => Environment Variables => Add OS_ACTIVITY_MODE:disable in the XCode.

Note: This works fine, but keep in mind that it also suppresses all NSLog output you may need for debugging.

enter image description here

like image 171
curest0x1021 Avatar answered Oct 09 '22 20:10

curest0x1021