Socket
Socket
Sign inDemoInstall

socket.io-client

Package Overview
Dependencies
Maintainers
2
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socket.io-client - npm Package Compare versions

Comparing version 4.1.3 to 4.2.0

2

build/index.js

@@ -21,3 +21,3 @@ "use strict";

opts = opts || {};
const parsed = url_1.url(uri, opts.path || "/socket.io");
const parsed = (0, url_1.url)(uri, opts.path || "/socket.io");
const source = parsed.source;

@@ -24,0 +24,0 @@ const id = parsed.id;

@@ -171,2 +171,9 @@ import { Socket, SocketOptions } from "./socket";

closeOnBeforeunload: boolean;
/**
* Whether to always use the native timeouts. This allows the client to
* reconnect when the native timeout functions are overridden, such as when
* mock clocks are installed.
* @default false
*/
useNativeTimers: boolean;
}

@@ -271,2 +278,3 @@ export interface ManagerOptions extends EngineOptions {

private backoff;
private setTimeoutFn;
private _reconnection;

@@ -273,0 +281,0 @@ private _reconnectionAttempts;

@@ -5,2 +5,3 @@ "use strict";

const eio = require("engine.io-client");
const util_1 = require("engine.io-client/lib/util");
const socket_1 = require("./socket");

@@ -14,2 +15,3 @@ const parser = require("socket.io-parser");

constructor(uri, opts) {
var _a;
super();

@@ -25,2 +27,3 @@ this.nsps = {};

this.opts = opts;
(0, util_1.installTimerFunctions)(this, opts);
this.reconnection(opts.reconnection !== false);

@@ -30,3 +33,3 @@ this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);

this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
this.randomizationFactor(opts.randomizationFactor || 0.5);
this.randomizationFactor((_a = opts.randomizationFactor) !== null && _a !== void 0 ? _a : 0.5);
this.backoff = new Backoff({

@@ -122,3 +125,3 @@ min: this.reconnectionDelay(),

// emit `open`
const openSubDestroy = on_1.on(socket, "open", function () {
const openSubDestroy = (0, on_1.on)(socket, "open", function () {
self.onopen();

@@ -128,3 +131,3 @@ fn && fn();

// emit `error`
const errorSub = on_1.on(socket, "error", (err) => {
const errorSub = (0, on_1.on)(socket, "error", (err) => {
debug("error");

@@ -149,3 +152,3 @@ self.cleanup();

// set timer
const timer = setTimeout(() => {
const timer = this.setTimeoutFn(() => {
debug("connect attempt timed out after %d", timeout);

@@ -190,3 +193,3 @@ openSubDestroy();

const socket = this.engine;
this.subs.push(on_1.on(socket, "ping", this.onping.bind(this)), on_1.on(socket, "data", this.ondata.bind(this)), on_1.on(socket, "error", this.onerror.bind(this)), on_1.on(socket, "close", this.onclose.bind(this)), on_1.on(this.decoder, "decoded", this.ondecoded.bind(this)));
this.subs.push((0, on_1.on)(socket, "ping", this.onping.bind(this)), (0, on_1.on)(socket, "data", this.ondata.bind(this)), (0, on_1.on)(socket, "error", this.onerror.bind(this)), (0, on_1.on)(socket, "close", this.onclose.bind(this)), (0, on_1.on)(this.decoder, "decoded", this.ondecoded.bind(this)));
}

@@ -342,3 +345,3 @@ /**

this._reconnecting = true;
const timer = setTimeout(() => {
const timer = this.setTimeoutFn(() => {
if (self.skipReconnect)

@@ -345,0 +348,0 @@ return;

@@ -29,2 +29,4 @@ "use strict";

super();
this.connected = false;
this.disconnected = true;
this.receiveBuffer = [];

@@ -37,9 +39,2 @@ this.sendBuffer = [];

this.nsp = nsp;
this.ids = 0;
this.acks = {};
this.receiveBuffer = [];
this.sendBuffer = [];
this.connected = false;
this.disconnected = true;
this.flags = {};
if (opts && opts.auth) {

@@ -61,6 +56,6 @@ this.auth = opts.auth;

this.subs = [
on_1.on(io, "open", this.onopen.bind(this)),
on_1.on(io, "packet", this.onpacket.bind(this)),
on_1.on(io, "error", this.onerror.bind(this)),
on_1.on(io, "close", this.onclose.bind(this)),
(0, on_1.on)(io, "open", this.onopen.bind(this)),
(0, on_1.on)(io, "packet", this.onpacket.bind(this)),
(0, on_1.on)(io, "error", this.onerror.bind(this)),
(0, on_1.on)(io, "close", this.onclose.bind(this)),
];

@@ -67,0 +62,0 @@ }

@@ -37,3 +37,3 @@ import Emitter = require("component-emitter");

*/
declare type FallbackToUntypedListener<T> = [T] extends [never] ? (...args: any[]) => void : T;
declare type FallbackToUntypedListener<T> = [T] extends [never] ? (...args: any[]) => void | Promise<void> : T;
/**

@@ -40,0 +40,0 @@ * Strictly typed version of an `EventEmitter`. A `TypedEventEmitter` takes type

@@ -0,1 +1,15 @@

# [4.2.0](https://github.com/socketio/socket.io-client/compare/4.1.3...4.2.0) (2021-08-30)
### Bug Fixes
* **typings:** allow async listener in typed events ([66e00b7](https://github.com/socketio/socket.io-client/commit/66e00b7dd7c4a09072cfd84c78e6e15ec52039f5))
* allow to set randomizationFactor to 0 ([#1447](https://github.com/socketio/socket.io-client/issues/1447)) ([dfb46b5](https://github.com/socketio/socket.io-client/commit/dfb46b55a55d9c5b0397f4bc0fab9cec99ff430e))
### Features
* add an option to use native timer functions ([#1479](https://github.com/socketio/socket.io-client/issues/1479)) ([4e1b656](https://github.com/socketio/socket.io-client/commit/4e1b65699d9967a7bb409bdc89c894c62562771b))
## [4.1.3](https://github.com/socketio/socket.io-client/compare/4.1.2...4.1.3) (2021-07-10)

@@ -2,0 +16,0 @@

{
"name": "socket.io-client",
"version": "4.1.3",
"version": "4.2.0",
"keywords": [

@@ -33,4 +33,4 @@ "realtime",

"component-emitter": "~1.3.0",
"debug": "~4.3.1",
"engine.io-client": "~5.1.2",
"debug": "~4.3.2",
"engine.io-client": "~5.2.0",
"parseuri": "0.0.6",

@@ -40,7 +40,9 @@ "socket.io-parser": "~4.0.4"

"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/core": "^7.15.0",
"@babel/plugin-transform-object-assign": "^7.14.5",
"@babel/preset-env": "^7.14.7",
"@types/mocha": "^8.2.2",
"@types/node": "^16.0.0",
"@babel/preset-env": "^7.15.0",
"@sinonjs/fake-timers": "^7.1.2",
"@types/mocha": "^9.0.0",
"@types/node": "^16.7.6",
"@types/sinonjs__fake-timers": "^6.0.3",
"babel-eslint": "^10.1.0",

@@ -61,5 +63,5 @@ "babel-loader": "^8.1.0",

"ts-loader": "^8.3.0",
"ts-node": "^10.0.0",
"ts-node": "^10.2.1",
"tsd": "^0.17.0",
"typescript": "^4.3.5",
"typescript": "^4.4.2",
"webpack": "^4.44.2",

@@ -66,0 +68,0 @@ "webpack-cli": "^3.3.12",

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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