Skip to content

Commit 177b95f

Browse files
fix(react-native): exclude the localAddress option
React Native only supports the "headers" option in the WebSocket constructor. Related: socketio/socket.io-client#1397
1 parent ccb99e3 commit 177b95f

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

lib/transports/websocket.js

+2-18
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,8 @@ class WS extends Transport {
5858
const uri = this.uri();
5959
const protocols = this.opts.protocols;
6060

61-
let opts;
62-
if (isReactNative) {
63-
opts = pick(this.opts, "localAddress");
64-
} else {
65-
opts = pick(
66-
this.opts,
67-
"agent",
68-
"perMessageDeflate",
69-
"pfx",
70-
"key",
71-
"passphrase",
72-
"cert",
73-
"ca",
74-
"ciphers",
75-
"rejectUnauthorized",
76-
"localAddress"
77-
);
78-
}
61+
// React Native only supports the 'headers' option, and will print a warning if anything else is passed
62+
const opts = isReactNative ? {} : this.opts;
7963

8064
if (this.opts.extraHeaders) {
8165
opts.headers = this.opts.extraHeaders;

0 commit comments

Comments
 (0)