Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

engine.io-client

Package Overview
Dependencies
Maintainers
2
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io-client - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

17

lib/socket.js

@@ -48,3 +48,3 @@ /**

this.secure = null != opts.secure ? opts.secure
: (global.location && 'https:' === location.protocol);
: (typeof location !== 'undefined' && 'https:' === location.protocol);

@@ -58,4 +58,4 @@ if (opts.hostname && !opts.port) {

this.hostname = opts.hostname ||
(global.location ? location.hostname : 'localhost');
this.port = opts.port || (global.location && location.port
(typeof location !== 'undefined' ? location.hostname : 'localhost');
this.port = opts.port || (typeof location !== 'undefined' && location.port
? location.port

@@ -99,5 +99,7 @@ : (this.secure ? 443 : 80));

// other options for Node.js client
var freeGlobal = typeof global === 'object' && global;
if (freeGlobal.global === freeGlobal) {
// detect ReactNative environment
this.isReactNative = (typeof navigator !== 'undefined' && typeof navigator.product === 'string' && navigator.product.toLowerCase() === 'reactnative');
// other options for Node.js or ReactNative client
if (typeof self === 'undefined' || this.isReactNative) {
if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {

@@ -202,3 +204,4 @@ this.extraHeaders = opts.extraHeaders;

requestTimeout: options.requestTimeout || this.requestTimeout,
protocols: options.protocols || void (0)
protocols: options.protocols || void (0),
isReactNative: this.isReactNative
});

@@ -205,0 +208,0 @@

@@ -44,2 +44,5 @@ /**

// results of ReactNative environment detection
this.isReactNative = opts.isReactNative;
// other options for Node.js client

@@ -46,0 +49,0 @@ this.extraHeaders = opts.extraHeaders;

@@ -30,3 +30,3 @@ /**

if (global.location) {
if (typeof location !== 'undefined') {
var isSSL = 'https:' === location.protocol;

@@ -33,0 +33,0 @@ var port = location.port;

@@ -1,2 +0,1 @@

/**

@@ -50,4 +49,4 @@ * Module requirements.

// we need to consider multiple engines in the same page
if (!global.___eio) global.___eio = [];
callbacks = global.___eio;
if (!window.___eio) window.___eio = [];
callbacks = window.___eio;
}

@@ -68,4 +67,4 @@

// prevent spurious errors from being emitted when the window is unloaded
if (global.document && global.addEventListener) {
global.addEventListener('beforeunload', function () {
if (typeof addEventListener === 'function') {
addEventListener('beforeunload', function () {
if (self.script) self.script.onerror = empty;

@@ -72,0 +71,0 @@ }, false);

@@ -0,1 +1,3 @@

/* global attachEvent */
/**

@@ -36,3 +38,3 @@ * Module requirements.

if (global.location) {
if (typeof location !== 'undefined') {
var isSSL = 'https:' === location.protocol;

@@ -46,3 +48,3 @@ var port = location.port;

this.xd = opts.hostname !== global.location.hostname ||
this.xd = (typeof location !== 'undefined' && opts.hostname !== location.hostname) ||
port !== opts.port;

@@ -276,3 +278,3 @@ this.xs = opts.secure !== isSSL;

if (global.document) {
if (typeof document !== 'undefined') {
this.index = Request.requestsCount++;

@@ -339,3 +341,3 @@ Request.requests[this.index] = this;

if (global.document) {
if (typeof document !== 'undefined') {
delete Request.requests[this.index];

@@ -380,3 +382,3 @@ }

Request.prototype.hasXDR = function () {
return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR;
return typeof XDomainRequest !== 'undefined' && !this.xs && this.enablesXDR;
};

@@ -403,7 +405,7 @@

if (global.document) {
if (global.attachEvent) {
global.attachEvent('onunload', unloadHandler);
} else if (global.addEventListener) {
global.addEventListener('beforeunload', unloadHandler, false);
if (typeof document !== 'undefined') {
if (typeof attachEvent === 'function') {
attachEvent('onunload', unloadHandler);
} else if (typeof addEventListener === 'function') {
addEventListener('beforeunload', unloadHandler, false);
}

@@ -410,0 +412,0 @@ }

@@ -11,8 +11,9 @@ /**

var debug = require('debug')('engine.io-client:websocket');
var BrowserWebSocket = global.WebSocket || global.MozWebSocket;
var NodeWebSocket;
if (typeof window === 'undefined') {
var BrowserWebSocket, NodeWebSocket;
if (typeof self === 'undefined') {
try {
NodeWebSocket = require('ws');
} catch (e) { }
} else {
BrowserWebSocket = self.WebSocket || self.MozWebSocket;
}

@@ -26,6 +27,3 @@

var WebSocket = BrowserWebSocket;
if (!WebSocket && typeof window === 'undefined') {
WebSocket = NodeWebSocket;
}
var WebSocket = BrowserWebSocket || NodeWebSocket;

@@ -114,3 +112,3 @@ /**

try {
this.ws = this.usingBrowserWebSocket ? (protocols ? new WebSocket(uri, protocols) : new WebSocket(uri)) : new WebSocket(uri, protocols, opts);
this.ws = this.usingBrowserWebSocket && !this.isReactNative ? (protocols ? new WebSocket(uri, protocols) : new WebSocket(uri)) : new WebSocket(uri, protocols, opts);
} catch (err) {

@@ -182,3 +180,3 @@ return this.emit('error', err);

if (self.perMessageDeflate) {
var len = 'string' === typeof data ? global.Buffer.byteLength(data) : data.length;
var len = 'string' === typeof data ? Buffer.byteLength(data) : data.length;
if (len < self.perMessageDeflate.threshold) {

@@ -185,0 +183,0 @@ opts.compress = false;

@@ -34,5 +34,5 @@ // browser shim for xmlhttprequest module

try {
return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');
return new self[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');
} catch (e) { }
}
};

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "3.2.1",
"version": "3.3.0",
"main": "lib/index.js",

@@ -36,3 +36,3 @@ "homepage": "https://github.com/socketio/engine.io-client",

"parseuri": "0.0.5",
"ws": "~3.3.1",
"ws": "~6.1.0",
"xmlhttprequest-ssl": "~1.5.4",

@@ -50,3 +50,3 @@ "yeast": "0.1.2"

"derequire": "^2.0.6",
"engine.io": "3.2.0",
"engine.io": "3.3.0",
"eslint-config-standard": "4.4.0",

@@ -64,6 +64,5 @@ "eslint-plugin-standard": "1.3.1",

"mocha": "^3.2.0",
"socket.io-browsers": "^1.0.0",
"webpack": "1.12.12",
"webpack-stream": "^3.2.0",
"zuul": "^3.11.1",
"zuul": "3.11.1",
"zuul-builder-webpack": "^1.2.0",

@@ -70,0 +69,0 @@ "zuul-ngrok": "4.0.0"

@@ -216,3 +216,3 @@

SSL/TLS connections, or if you know that your network does not block websockets.
- `pfx` (`String`): Certificate, Private key and CA certificates to use for SSL. Can be used in Node.js client environment to manually specify certificate information.
- `pfx` (`String`|`Buffer`): Certificate, Private key and CA certificates to use for SSL. Can be used in Node.js client environment to manually specify certificate information.
- `key` (`String`): Private key to use for SSL. Can be used in Node.js client environment to manually specify certificate information.

@@ -219,0 +219,0 @@ - `passphrase` (`String`): A string of passphrase for the private key or pfx. Can be used in Node.js client environment to manually specify certificate information.

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc