Have you ever met this message in a React Native application using a WebSocket ( SocketIOClient from 'socket.io-client') ?...
Unrecognized WebSocket connection option(s) `agent`, `perMessageDeflate`, `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`. Did you mean to put these under `headers`?
Yes, this is happening in the WebSocket class constructor in Socket.io. I think it happens when you specify your transport layer as 'websocket' in the constructor (which is necessary for React Native socket io use). It doesn't do anything bad, but is annoying.
You can get rid of it with the react-native YellowBox.ignoreWarnings
:
When initiating your app:
console.ignoredYellowBox = ['Remote debugger'];
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`?'
]);
The one way to remove the error:
let socket = io.connect(SOCKET_URL, {
timeout: 10000,
jsonp: false,
transports: [‘websocket’],
autoConnect: false,
agent: ‘-’,
path: ‘/’, // Whatever your path is
pfx: ‘-’,
key: token, // Using token-based auth.
passphrase: cookie, // Using cookie auth.
cert: ‘-’,
ca: ‘-’,
ciphers: ‘-’,
rejectUnauthorized: ‘-’,
perMessageDeflate: ‘-’
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With