Fix error code [1006] if protocols is undefined (#735)

This commit is contained in:
Flavio Curella 2017-09-12 10:22:24 -07:00 committed by Andrew Godwin
parent f34ca1cd2b
commit 3111f3b8ac
3 changed files with 10 additions and 3 deletions

View File

@ -283,7 +283,10 @@ var WebSocketBridge = function () {
_url = url; _url = url;
} }
} }
this.socket = new _reconnectingWebsocket2.default(_url, protocols, options); // Some mobile devices (eg: HTC M8, SAMSUNG Galaxy S8) will get error code
// [1006] during handshake if `protocols` is `undefined`.
var _protocols = protocols === undefined ? '' : protocols;
this.socket = new _reconnectingWebsocket2.default(_url, _protocols, options);
} }
/** /**

View File

@ -72,7 +72,8 @@ var WebSocketBridge = function () {
_url = url; _url = url;
} }
} }
this.socket = new _reconnectingWebsocket2.default(_url, protocols, options); var _protocols = protocols === undefined ? '' : protocols;
this.socket = new _reconnectingWebsocket2.default(_url, _protocols, options);
} }
/** /**

View File

@ -50,7 +50,10 @@ export class WebSocketBridge {
_url = url; _url = url;
} }
} }
this.socket = new ReconnectingWebSocket(_url, protocols, options); // Some mobile devices (eg: HTC M8, SAMSUNG Galaxy S8) will get error code
// [1006] during handshake if `protocols` is `undefined`.
const _protocols = protocols === undefined ? '' : protocols;
this.socket = new ReconnectingWebSocket(_url, _protocols, options);
} }
/** /**