engine.io-client
Advanced tools
Comparing version 3.3.1 to 3.3.2
@@ -11,9 +11,13 @@ /** | ||
var debug = require('debug')('engine.io-client:websocket'); | ||
var BrowserWebSocket, NodeWebSocket; | ||
if (typeof self === 'undefined') { | ||
if (typeof WebSocket !== 'undefined') { | ||
BrowserWebSocket = WebSocket; | ||
} else if (typeof self !== 'undefined') { | ||
BrowserWebSocket = self.WebSocket || self.MozWebSocket; | ||
} else { | ||
try { | ||
NodeWebSocket = require('ws'); | ||
} catch (e) { } | ||
} else { | ||
BrowserWebSocket = self.WebSocket || self.MozWebSocket; | ||
} | ||
@@ -27,3 +31,3 @@ | ||
var WebSocket = BrowserWebSocket || NodeWebSocket; | ||
var WebSocketImpl = BrowserWebSocket || NodeWebSocket; | ||
@@ -52,3 +56,3 @@ /** | ||
if (!this.usingBrowserWebSocket) { | ||
WebSocket = NodeWebSocket; | ||
WebSocketImpl = NodeWebSocket; | ||
} | ||
@@ -113,3 +117,8 @@ Transport.call(this, opts); | ||
try { | ||
this.ws = this.usingBrowserWebSocket && !this.isReactNative ? (protocols ? new WebSocket(uri, protocols) : new WebSocket(uri)) : new WebSocket(uri, protocols, opts); | ||
this.ws = | ||
this.usingBrowserWebSocket && !this.isReactNative | ||
? protocols | ||
? new WebSocketImpl(uri, protocols) | ||
: new WebSocketImpl(uri) | ||
: new WebSocketImpl(uri, protocols, opts); | ||
} catch (err) { | ||
@@ -287,3 +296,3 @@ return this.emit('error', err); | ||
WS.prototype.check = function () { | ||
return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name); | ||
return !!WebSocketImpl && !('__initialize' in WebSocketImpl && this.name === WS.prototype.name); | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"main": "lib/index.js", | ||
@@ -8,0 +8,0 @@ "homepage": "https://github.com/socketio/engine.io-client", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
176096
5658