diff --git a/channels/static/channels/js/websocketbridge.js b/channels/static/channels/js/websocketbridge.js index d7b2845..e5650e4 100644 --- a/channels/static/channels/js/websocketbridge.js +++ b/channels/static/channels/js/websocketbridge.js @@ -283,7 +283,10 @@ var WebSocketBridge = function () { _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); } /** diff --git a/js_client/lib/index.js b/js_client/lib/index.js index 53ca4f0..0e69313 100644 --- a/js_client/lib/index.js +++ b/js_client/lib/index.js @@ -72,7 +72,8 @@ var WebSocketBridge = function () { _url = url; } } - this.socket = new _reconnectingWebsocket2.default(_url, protocols, options); + var _protocols = protocols === undefined ? '' : protocols; + this.socket = new _reconnectingWebsocket2.default(_url, _protocols, options); } /** diff --git a/js_client/src/index.js b/js_client/src/index.js index b2ebd81..ae0fd48 100644 --- a/js_client/src/index.js +++ b/js_client/src/index.js @@ -50,7 +50,10 @@ export class WebSocketBridge { _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); } /**