Feathers: React Native + Expo: Unrecognized WebSocket connection option(s)

Created on 8 Mar 2020  路  5Comments  路  Source: feathersjs/feathers

Steps to reproduce

  1. Create a new blank react native project with: expo init project
  2. Strictly follow the installation guide, importing the code block to App.tsx.

Expected behavior

FeathersJS client working, connected to the server.

Actual behavior

Unrecognized WebSocket connection option(s) `agent`, `perMessageDeflate`, `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`. Did you mean to put these under `headers`?
- node_modules/expo/build/environment/muteWarnings.fx.js:18:23 in warn
- node_modules/react-native/Libraries/WebSocket/WebSocket.js:118:8 in constructor
- node_modules/engine.io-client/lib/transports/websocket.js:115:6 in WS.prototype.doOpen
- node_modules/engine.io-client/lib/transport.js:83:9 in Transport.prototype.open
* http://192.168.1.13:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:144338:19 in open
- node_modules/engine.io-client/lib/socket.js:120:7 in Socket
- node_modules/engine.io-client/lib/socket.js:27:28 in Socket
- node_modules/socket.io-client/lib/manager.js:225:7 in Manager.prototype.connect
- node_modules/socket.io-client/lib/manager.js:538:15 in setTimeout$argument_0
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:146:14 in _callTimer
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:399:17 in callTimers
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:436:47 in __callFunction
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:111:26 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:110:17 in __guard$argument_0
* [native code]:null in callFunctionReturnFlushedQueue

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

    "@feathersjs/feathers": "^4.5.2",
    "@feathersjs/socketio-client": "^4.5.2",
    "socket.io-client": "^2.3.0"

NodeJS version: v12.11.1

Operating System: Linux

Browser Version: N/A

React Native Version: sdk-36.0.0

Module Loader: Expo

Most helpful comment

You can simply add these add headers and it works!
this.socket = io.connect('SOCKET_URL', { jsonp: false, agent: '-', pfx: '-', cert: '-', ca: '-', ciphers: '-', rejectUnauthorized: '-', perMessageDeflate: '-' });

All 5 comments

I faced the some issue with my react native app, downgrade your socket.io-client.
I'm using "socket.io-client": "^2.1.0" and it works perfectly fine.

I'm going to close this since this error can only be fixed in the upstream socket.io client library or by downgrading as suggested.

You can simply add these add headers and it works!
this.socket = io.connect('SOCKET_URL', { jsonp: false, agent: '-', pfx: '-', cert: '-', ca: '-', ciphers: '-', rejectUnauthorized: '-', perMessageDeflate: '-' });

@vigneshwaran-dev Why all those fake options?

Was this page helpful?
0 / 5 - 0 ratings