Fixed: some device will get error code [1006] when handshake if protocols is undefined. (#691)

This commit is contained in:
bmcool 2017-09-02 00:47:27 +08:00 committed by Andrew Godwin
parent c0138e8dd9
commit ed32c71d90

View File

@ -115,7 +115,12 @@ var ReconnectingWebsocket = function (url, protocols, options) {
var connect = function () {
log('connect');
var oldWs = ws;
if (protocols === undefined) {
ws = new config.constructor(url);
} else {
ws = new config.constructor(url, protocols);
}
connectingTimeout = setTimeout(function () {
log('timeout');
ws.close();