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
Unrecognized WebSocket connection option(s) agent
, perMessageDeflate
, pfx
, key
, passphrase
, cert
, ca
, ciphers
, rejectUnauthorized
. Did you mean to put these under headers
?
#1290
Comments
Same problem :( |
+1 |
1 similar comment
+1 |
+1 Seems to have been an issue since at least as far back as Dec 18 |
+1 |
1 similar comment
+1 |
+1 |
1 similar comment
+1 |
I am still getting this warning when using socket.io (2.2.0) on React-Native. I can silence the yellow box on the device screen with: import { YellowBox } from 'react-native'
YellowBox.ignoreWarnings([
'Unrecognized WebSocket connection option(s) `agent`, `perMessageDeflate`, `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`. Did you mean to put these under `headers`?'
]) but I still get this annoying warning on the console... |
downgrade to "socket.io-client": "2.1.0" and all OK |
For me it worked when I downgraded to 2.1.1 I did: At first it didn't work because I was adding the |
Still an issue @2.2.0 |
Try downgrading socket.io-client to 1.7.2, it works for me. |
Still an issue @^2.3.0 |
Still an issue |
@2.1.1 is OK. But 2.3.0 throws the warning message on RN 0.61.1 |
any solution till now |
Still an issue v2.3.0 with react-native |
Hey guys! We have fixed this issue by downgrading to v2.1.1 Make sure you completely remove the older version and clear the cache.
Done! This should work with react-native & react-native-web! |
I have this same issue with This is my conf: |
|
This warning is raised here by By inserting something like the code below at // lib/transports/websocket.js
...
if (this.isReactNative) {
// prettier-ignore
opts = omit(opts, ['agent', 'perMessageDeflate', 'pfx', 'key', 'passphrase', 'cert', 'ca', 'ciphers', 'rejectUnauthorized']);
}
... If you're looking for a solution that doesn't involve simply muting the warning via // index.js
...
+ import 'patches/EngineIOHeaderWarning';
... // patches/EngineIOHeaderWarning.js
const WS = require('engine.io-client/lib/transports/websocket');
var WebSocketImpl = WebSocket; // eslint-disable-line no-undef
WS.prototype.doOpen = function() {
if (!this.check()) {
// let probe timeout
return;
}
var uri = this.uri();
var protocols = this.protocols;
var opts = {};
if (this.extraHeaders) {
opts.headers = this.extraHeaders;
}
if (this.localAddress) {
opts.localAddress = this.localAddress;
}
try {
this.ws = new WebSocketImpl(uri, protocols, opts);
} catch (err) {
return this.emit('error', err);
}
}; Overall, if we create a pull request for EngineIO to exclude these extra |
My Solution: Just save the socket in a useState like this: import io from 'socket.io-client';
Problem solved. |
In my case, v2.3 is ok when I connect to the local socket.io server. |
Your code wouldn't allow me to connect to the server and changed the intended behaviour of EngineIO so I've just wrapped those options in an if statement but used the same patch mechanism you suggested
|
This worked for me. |
If I well understand the issue, is this a related dependencies issue introduce in 06e9a4c? |
The downgrade to 2.1.1 works indeed, but we are stuck on a two years old releases. Can @ptboyer be applied and release on the project? |
Does this warning affect the functionality of the package? Just setting it up and don't want to be held back by this. Happy to ignore if it has no other consequences Edit: For anyone wondering the same thing. As far as I can tell this warning is inconsequential. |
@schumannd This issue is purely about muting the error/warning message. Functionally, this warning is inconsequential. :) |
+1 |
I am very worried about if the socket.io library is still maintained or not because of no official reply about a fix or an upcoming update. |
+1 |
1 similar comment
+1 |
|
@isthaison It doesn't work for me |
@isthaison for me it works... but every other http request becomes very slow... I don't know how it's related to the workaround... but it is... |
Thank you. this work for me. |
This is the only solution that worked for me.
|
It works with me, Thanks!
const socket = io(host, { forceNode: true }); |
It worked for me too! Big thanks |
You can simply add some headers and it works! |
This resolves the warning but makes my socket connection really really slow(timeout actually), so its unusable for me. |
same here: connection timeout! |
I got rid of froceNode and downgraded to |
The same @SaveYourTime , I'm using |
This issue should be fixed on |
@BassemN Perhaps instead of deleting your yarn.lock file, you could use It seems a bit counter-intuitive to the idea of a "lock" file if you completely destroy it every time you want to upgrade your packages. 😅 |
It should be fixed by socketio/engine.io-client@e5bc106 (included in Regarding the |
Proxying WebSockets is working for me. Server Side: Front Side: |
You want to:
Current behaviour
When I install
socket.io-client
on a blank React Native Expo project I have a yellow message with:Steps to reproduce (if the current behaviour is a bug)
yarn add socket.io-client
In App.js in the React Native project:
The text was updated successfully, but these errors were encountered: