🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

socket.io-adapter

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socket.io-adapter - npm Package Compare versions

Comparing version
2.5.5
to
2.5.6
+9
-5
dist/cluster-adapter.js

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

MessageType[MessageType["ADAPTER_CLOSE"] = 13] = "ADAPTER_CLOSE";
})(MessageType = exports.MessageType || (exports.MessageType = {}));
})(MessageType || (exports.MessageType = MessageType = {}));
function encodeOptions(opts) {

@@ -79,2 +79,5 @@ return {

}
if (message.nsp !== this.nsp.name) {
return debug("[%s] ignore message from another namespace (%s)", this.uid, message.nsp);
}
debug("[%s] new event of type %d from %s", this.uid, message.type, message.uid);

@@ -439,3 +442,3 @@ switch (message.type) {

data: {
requestId,
requestId, // the presence of this attribute defines whether an acknowledgement is needed
packet,

@@ -446,2 +449,3 @@ },

publish(message) {
debug("[%s] sending message %s", this.uid, message.type);
this.publishAndReturnOffset(message).catch((err) => {

@@ -459,2 +463,3 @@ debug("[%s] error while publishing message: %s", this.uid, err);

response.nsp = this.nsp.name;
debug("[%s] sending response %s to %s", this.uid, response.type, requesterUid);
this.doPublishResponse(requesterUid, response).catch((err) => {

@@ -517,6 +522,5 @@ debug("[%s] error while publishing response: %s", this.uid, err);

if (message.uid && message.uid !== EMITTER_UID) {
// we track the UID of each sender, in order to know how many servers there are in the cluster
// we track the UID of each sender to know how many servers there are in the cluster
this.nodesMap.set(message.uid, Date.now());
}
debug("[%s] new event of type %d from %s", this.uid, message.type, message.uid);
switch (message.type) {

@@ -580,3 +584,3 @@ case MessageType.INITIAL_HEARTBEAT:

data: {
requestId,
requestId, // the presence of this attribute defines whether an acknowledgement is needed
packet,

@@ -583,0 +587,0 @@ },

// imported from https://github.com/unshiftio/yeast
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.yeast = exports.decode = exports.encode = void 0;
exports.encode = encode;
exports.decode = decode;
exports.yeast = yeast;
const alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""), length = 64, map = {};

@@ -22,3 +24,2 @@ let seed = 0, i = 0, prev;

}
exports.encode = encode;
/**

@@ -38,3 +39,2 @@ * Return the integer value specified by the given string.

}
exports.decode = decode;
/**

@@ -52,3 +52,2 @@ * Yeast: A tiny growing id generator.

}
exports.yeast = yeast;
//

@@ -55,0 +54,0 @@ // Map each character to its index.

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

/// <reference types="node" />
import { EventEmitter } from "events";

@@ -43,3 +42,3 @@ /**

*
* @param {Namespace} nsp
* @param nsp
*/

@@ -46,0 +45,0 @@ constructor(nsp: any);

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

const WebSocket = require("ws");
// @ts-expect-error
const canPreComputeFrame = typeof ((_a = WebSocket === null || WebSocket === void 0 ? void 0 : WebSocket.Sender) === null || _a === void 0 ? void 0 : _a.frame) === "function";

@@ -14,3 +15,3 @@ class Adapter extends events_1.EventEmitter {

*
* @param {Namespace} nsp
* @param nsp
*/

@@ -22,3 +23,3 @@ constructor(nsp) {

this.sids = new Map();
this.encoder = nsp.server.encoder;
this.encoder = nsp.server.encoder; // nsp is a Namespace object
}

@@ -177,2 +178,3 @@ /**

// see https://github.com/websockets/ws/issues/617#issuecomment-283002469
// @ts-expect-error
packetOpts.wsPreEncodedFrame = WebSocket.Sender.frame(data, {

@@ -179,0 +181,0 @@ readOnly: false,

(The MIT License)
Copyright (c) 2014 Guillermo Rauch <guillermo@learnboost.com>
Copyright (c) 2014-present Guillermo Rauch and Socket.IO contributors

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

{
"name": "socket.io-adapter",
"version": "2.5.5",
"version": "2.5.6",
"license": "MIT",
"homepage": "https://github.com/socketio/socket.io/tree/main/packages/socket.io-adapter#readme",
"repository": {
"type": "git",
"url": "git://github.com/socketio/socket.io-adapter.git"
"url": "git+https://github.com/socketio/socket.io.git"
},
"bugs": {
"url": "https://github.com/socketio/socket.io/issues"
},
"files": [

@@ -16,25 +20,12 @@ "dist/"

"dependencies": {
"debug": "~4.3.4",
"ws": "~8.17.1"
"debug": "~4.4.1",
"ws": "~8.18.3"
},
"devDependencies": {
"@types/debug": "^4.1.12",
"@types/expect.js": "^0.3.32",
"@types/mocha": "^10.0.1",
"@types/node": "^14.11.2",
"expect.js": "^0.3.1",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"prettier": "^2.8.1",
"socket.io": "^4.7.4",
"socket.io-client": "^4.7.4",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
"scripts": {
"test": "npm run format:check && tsc && nyc mocha --require ts-node/register test/*.ts",
"compile": "rimraf ./dist && tsc",
"test": "npm run format:check && npm run compile && nyc mocha --import=tsx test/*.ts",
"format:check": "prettier --parser typescript --check 'lib/**/*.ts' 'test/**/*.ts'",
"format:fix": "prettier --parser typescript --write 'lib/**/*.ts' 'test/**/*.ts'",
"prepack": "tsc"
"prepack": "npm run compile"
}
}