Compare commits

...

6 Commits

Author SHA1 Message Date
Damien Arrachequesne
dd71792455 chore(release): socket.io@4.8.2
Diff: https://github.com/socketio/socket.io/compare/socket.io@4.8.1...socket.io@4.8.2
2025-12-22 17:42:41 +01:00
Ihor Machuzhak
bb0b480d2a fix(sio): improve io.close() function (#5344)
Before this change, `await io.close();` would resolve before the HTTP server was properly shut down.

Related: https://github.com/socketio/socket.io/pull/4971
2025-12-22 17:37:24 +01:00
Damien Arrachequesne
161be91975 test(sio): pin version of the client bundle in the tests 2025-12-22 17:35:35 +01:00
Damien Arrachequesne
fd9d4cab5e chore(release): socket.io-client@4.8.2
Diff: https://github.com/socketio/socket.io/compare/socket.io-client@4.8.1...socket.io-client@4.8.2
2025-12-22 16:52:21 +01:00
Damien Arrachequesne
0a99ac44a2 chore(release): engine.io@6.6.5
Diff: https://github.com/socketio/socket.io/compare/engine.io@6.6.4...engine.io@6.6.5
2025-12-22 16:27:31 +01:00
Damien Arrachequesne
4338f47336 ci(publish): use Node.js 24
Trusted publishing requires npm CLI version 11.5.1 or later.

Reference: https://docs.npmjs.com/trusted-publishers#for-github-actions
2025-12-22 16:27:30 +01:00
27 changed files with 269 additions and 125 deletions

View File

@@ -19,10 +19,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js 20
- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies

View File

@@ -1,7 +1,8 @@
# History
# Changelog
| Version | Release date |
|------------------------------------------------------------------------------------------------------|----------------|
| [6.6.5](#665-2025-12-22) | December 2025 |
| [6.6.4](#664-2025-01-28) | January 2025 |
| [6.6.3](#663-2025-01-23) | January 2025 |
| [6.6.2](#662-2024-10-09) | October 2024 |
@@ -47,7 +48,16 @@
| [3.4.1](#341-2020-04-17) | April 2020 |
# Release notes
## [6.6.5](https://github.com/socketio/socket.io/compare/engine.io@6.6.4...engine.io@6.6.5) (2025-12-22)
The `url.parse()` function is now deprecated and has been replaced by `new URL()` (see [e08293b](https://github.com/socketio/socket.io/commit/e08293bc3735de5b824b347383e86e0b8ab9fbd5b).
### Dependencies
- [`ws@~8.18.3`](https://github.com/websockets/ws/releases/tag/8.18.3) ([diff](https://github.com/websockets/ws/compare/8.17.1...8.18.3))
## [6.6.4](https://github.com/socketio/socket.io/compare/engine.io@6.6.3...engine.io@6.6.4) (2025-01-28)

View File

@@ -1,6 +1,6 @@
{
"name": "engine.io",
"version": "6.6.4",
"version": "6.6.5",
"description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server",
"type": "commonjs",
"main": "./build/engine.io.js",

View File

@@ -1,7 +1,8 @@
# History
# Changelog
| Version | Release date | Bundle size (UMD min+gzip) |
|-------------------------------------------------------------------------------------------------------------|----------------|----------------------------|
| [4.8.2](#482-2025-12-22) | December 2024 | `14.4 KB` |
| [4.8.1](#481-2024-10-25) | October 2024 | `14.4 KB` |
| [4.8.0](#480-2024-09-21) | September 2024 | `14.4 KB` |
| [4.7.5](#475-2024-03-14) | March 2024 | `14.6 KB` |
@@ -50,7 +51,21 @@
| [2.1.0](#210-2018-03-29) | March 2018 | `18.7 KB` |
# Release notes
## [4.8.2](https://github.com/socketio/socket.io/compare/socket.io-client@4.8.1...socket.io-client@4.8.2) (2025-12-22)
### Bug Fixes
* **bundle** do not mangle the "_placeholder" attribute (bis) ([cdae019](https://github.com/socketio/socket.io/commit/cdae01983a8ae840fc9812875a8b88166b377c11))
* drain queue before emitting "connect" ([#5259](https://github.com/socketio/socket.io/issues/5259)) ([d19928e](https://github.com/socketio/socket.io/commit/d19928e8d8b325310274031ed7de2ddc93ebb589)
### Dependencies
- [`engine.io-client@~6.6.1`](https://github.com/socketio/engine.io-client/releases/tag/6.5.2) (no change)
- [`ws@~8.17.1`](https://github.com/websockets/ws/releases/tag/8.17.1) (no change)
## [4.8.1](https://github.com/socketio/socket.io/compare/socket.io-client@4.8.0...socket.io-client@4.8.1) (2024-10-25)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/*!
* Socket.IO v4.8.1
* (c) 2014-2024 Guillermo Rauch
* Socket.IO v4.8.2
* (c) 2014-2025 Guillermo Rauch
* Released under the MIT License.
*/
(function (global, factory) {
@@ -899,7 +899,7 @@
return hostname.indexOf(":") === -1 ? hostname : "[" + hostname + "]";
};
_proto._port = function _port() {
if (this.opts.port && (this.opts.secure && Number(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80)) {
if (this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80)) {
return ":" + this.opts.port;
} else {
return "";
@@ -2669,21 +2669,65 @@
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];
var i;
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
var len = split.length;
for (i = 0; i < len; i++) {
if (!split[i]) {
// ignore empty strings
continue;
var split = (typeof namespaces === 'string' ? namespaces : '').trim().replace(/\s+/g, ',').split(',').filter(Boolean);
var _iterator = _createForOfIteratorHelper(split),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ns = _step.value;
if (ns[0] === '-') {
createDebug.skips.push(ns.slice(1));
} else {
createDebug.names.push(ns);
}
}
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
/**
* Checks if the given string matches a namespace template, honoring
* asterisks as wildcards.
*
* @param {String} search
* @param {String} template
* @return {Boolean}
*/
function matchesTemplate(search, template) {
var searchIndex = 0;
var templateIndex = 0;
var starIndex = -1;
var matchIndex = 0;
while (searchIndex < search.length) {
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
// Match character or proceed with wildcard
if (template[templateIndex] === '*') {
starIndex = templateIndex;
matchIndex = searchIndex;
templateIndex++; // Skip the '*'
} else {
searchIndex++;
templateIndex++;
}
} else if (starIndex !== -1) {
// eslint-disable-line no-negated-condition
// Backtrack to the last '*' and try to match more characters
templateIndex = starIndex + 1;
matchIndex++;
searchIndex = matchIndex;
} else {
createDebug.names.push(new RegExp('^' + namespaces + '$'));
return false; // No match
}
}
// Handle trailing '*' in template
while (templateIndex < template.length && template[templateIndex] === '*') {
templateIndex++;
}
return templateIndex === template.length;
}
/**
@@ -2693,7 +2737,7 @@
* @api public
*/
function disable() {
var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {
var namespaces = [].concat(_toConsumableArray(createDebug.names), _toConsumableArray(createDebug.skips.map(function (namespace) {
return '-' + namespace;
}))).join(',');
createDebug.enable('');
@@ -2708,35 +2752,37 @@
* @api public
*/
function enabled(name) {
if (name[name.length - 1] === '*') {
return true;
}
var i;
var len;
for (i = 0, len = createDebug.skips.length; i < len; i++) {
if (createDebug.skips[i].test(name)) {
return false;
var _iterator2 = _createForOfIteratorHelper(createDebug.skips),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var skip = _step2.value;
if (matchesTemplate(name, skip)) {
return false;
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
for (i = 0, len = createDebug.names.length; i < len; i++) {
if (createDebug.names[i].test(name)) {
return true;
var _iterator3 = _createForOfIteratorHelper(createDebug.names),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var ns = _step3.value;
if (matchesTemplate(name, ns)) {
return true;
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
return false;
}
/**
* Convert regexp to namespace
*
* @param {RegExp} regxep
* @return {String} namespace
* @api private
*/
function toNamespace(regexp) {
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
}
/**
* Coerce `val`.
*
@@ -2812,15 +2858,17 @@
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
}
var m;
// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
// eslint-disable-next-line no-return-assign
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
// Is firebug? http://stackoverflow.com/a/398120/376773
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 ||
// Double check webkit in userAgent just in case we are in a worker
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
@@ -2896,7 +2944,7 @@
function load() {
var r;
try {
r = exports.storage.getItem('debug');
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG');
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
@@ -3828,8 +3876,7 @@
};
args.push(function (err) {
if (packet !== _this4._queue[0]) {
// the packet has already been acknowledged
return;
return debug$2("packet [%d] already acknowledged", packet.id);
}
var hasError = err !== null;
if (hasError) {
@@ -4100,8 +4147,8 @@
this._pid = pid; // defined only if connection state recovery is enabled
this.connected = true;
this.emitBuffered();
this.emitReserved("connect");
this._drainQueue(true);
this.emitReserved("connect");
}
/**
* Emit buffered events (received and emitted).

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "socket.io-client",
"version": "4.8.1",
"version": "4.8.2",
"description": "Realtime application framework client",
"keywords": [
"realtime",

View File

@@ -1,5 +1,5 @@
{
"name": "socket.io-client",
"version": "4.7.5",
"version": "4.8.2",
"type": "module"
}

View File

@@ -1,7 +1,8 @@
# History
# Changelog
| Version | Release date |
|--------------------------------------------------------------------------------------------------|----------------|
| [4.8.2](#482-2025-12-22) | December 2025 |
| [4.8.1](#481-2024-10-25) | October 2024 |
| [4.8.0](#480-2024-09-21) | September 2024 |
| [4.7.5](#475-2024-03-14) | March 2024 |
@@ -49,7 +50,22 @@
| [2.1.0](#210-2018-03-29) | March 2018 |
# Release notes
## [4.8.2](https://github.com/socketio/socket.io/compare/socket.io@4.8.1...socket.io@4.8.2) (2025-12-22)
The `url.parse()` function is now deprecated and has been replaced by `new URL()` (see [8af7019](https://github.com/socketio/socket.io/commit/8af70195bb8c5bc3efe9685997ab6373fb8b1ca9)).
### Bug Fixes
* call adapter.init() when creating each namespace ([f3e1f5e](https://github.com/socketio/socket.io/commit/f3e1f5ebdf59158d0c8d1e20f8230275617fb355))
* improve `io.close()` function ([#5344](https://github.com/socketio/socket.io/issues/5344)) ([bb0b480](https://github.com/socketio/socket.io/commit/bb0b480d2ab3108a8ae255b539015da451fdb249))
### Dependencies
- [`engine.io@~6.6.0`](https://github.com/socketio/engine.io/releases/tag/6.6.0) (no change)
- [`ws@~8.18.3`](https://github.com/websockets/ws/releases/tag/8.18.3) ([diff](https://github.com/websockets/ws/compare/8.17.1...8.18.3))
## [4.8.1](https://github.com/socketio/socket.io/compare/socket.io@4.8.0...socket.io@4.8.1) (2024-10-25)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/*!
* Socket.IO v4.8.1
* (c) 2014-2024 Guillermo Rauch
* Socket.IO v4.8.2
* (c) 2014-2025 Guillermo Rauch
* Released under the MIT License.
*/
(function (global, factory) {
@@ -899,7 +899,7 @@
return hostname.indexOf(":") === -1 ? hostname : "[" + hostname + "]";
};
_proto._port = function _port() {
if (this.opts.port && (this.opts.secure && Number(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80)) {
if (this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80)) {
return ":" + this.opts.port;
} else {
return "";
@@ -2669,21 +2669,65 @@
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];
var i;
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
var len = split.length;
for (i = 0; i < len; i++) {
if (!split[i]) {
// ignore empty strings
continue;
var split = (typeof namespaces === 'string' ? namespaces : '').trim().replace(/\s+/g, ',').split(',').filter(Boolean);
var _iterator = _createForOfIteratorHelper(split),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ns = _step.value;
if (ns[0] === '-') {
createDebug.skips.push(ns.slice(1));
} else {
createDebug.names.push(ns);
}
}
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
/**
* Checks if the given string matches a namespace template, honoring
* asterisks as wildcards.
*
* @param {String} search
* @param {String} template
* @return {Boolean}
*/
function matchesTemplate(search, template) {
var searchIndex = 0;
var templateIndex = 0;
var starIndex = -1;
var matchIndex = 0;
while (searchIndex < search.length) {
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
// Match character or proceed with wildcard
if (template[templateIndex] === '*') {
starIndex = templateIndex;
matchIndex = searchIndex;
templateIndex++; // Skip the '*'
} else {
searchIndex++;
templateIndex++;
}
} else if (starIndex !== -1) {
// eslint-disable-line no-negated-condition
// Backtrack to the last '*' and try to match more characters
templateIndex = starIndex + 1;
matchIndex++;
searchIndex = matchIndex;
} else {
createDebug.names.push(new RegExp('^' + namespaces + '$'));
return false; // No match
}
}
// Handle trailing '*' in template
while (templateIndex < template.length && template[templateIndex] === '*') {
templateIndex++;
}
return templateIndex === template.length;
}
/**
@@ -2693,7 +2737,7 @@
* @api public
*/
function disable() {
var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {
var namespaces = [].concat(_toConsumableArray(createDebug.names), _toConsumableArray(createDebug.skips.map(function (namespace) {
return '-' + namespace;
}))).join(',');
createDebug.enable('');
@@ -2708,35 +2752,37 @@
* @api public
*/
function enabled(name) {
if (name[name.length - 1] === '*') {
return true;
}
var i;
var len;
for (i = 0, len = createDebug.skips.length; i < len; i++) {
if (createDebug.skips[i].test(name)) {
return false;
var _iterator2 = _createForOfIteratorHelper(createDebug.skips),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var skip = _step2.value;
if (matchesTemplate(name, skip)) {
return false;
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
for (i = 0, len = createDebug.names.length; i < len; i++) {
if (createDebug.names[i].test(name)) {
return true;
var _iterator3 = _createForOfIteratorHelper(createDebug.names),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var ns = _step3.value;
if (matchesTemplate(name, ns)) {
return true;
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
return false;
}
/**
* Convert regexp to namespace
*
* @param {RegExp} regxep
* @return {String} namespace
* @api private
*/
function toNamespace(regexp) {
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
}
/**
* Coerce `val`.
*
@@ -2812,15 +2858,17 @@
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
}
var m;
// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
// eslint-disable-next-line no-return-assign
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
// Is firebug? http://stackoverflow.com/a/398120/376773
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 ||
// Double check webkit in userAgent just in case we are in a worker
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
}
@@ -2896,7 +2944,7 @@
function load() {
var r;
try {
r = exports.storage.getItem('debug');
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG');
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
@@ -3828,8 +3876,7 @@
};
args.push(function (err) {
if (packet !== _this4._queue[0]) {
// the packet has already been acknowledged
return;
return debug$2("packet [%d] already acknowledged", packet.id);
}
var hasError = err !== null;
if (hasError) {
@@ -4100,8 +4147,8 @@
this._pid = pid; // defined only if connection state recovery is enabled
this.connected = true;
this.emitBuffered();
this.emitReserved("connect");
this._drainQueue(true);
this.emitReserved("connect");
}
/**
* Emit buffered events (received and emitted).

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -831,7 +831,16 @@ export class Server<
restoreAdapter();
if (this.httpServer) {
this.httpServer.close(fn);
await new Promise<void>((resolve, reject) => {
this.httpServer.close((err) => {
fn && fn(err);
if (err) {
reject(err);
} else {
resolve();
}
});
});
} else {
fn && fn();
}

View File

@@ -1,6 +1,6 @@
{
"name": "socket.io",
"version": "4.8.1",
"version": "4.8.2",
"description": "node.js realtime framework server",
"keywords": [
"realtime",

View File

@@ -6,7 +6,7 @@ import { getPort, successFn } from "./support/util";
describe("server attachment", () => {
describe("http.Server", () => {
const clientVersion = require("socket.io-client/package.json").version;
const clientVersion = require("../package.json").version;
const testSource = (filename) => (done) => {
const srv = createServer();

View File

@@ -229,7 +229,7 @@ describe("socket.io with uWebSocket.js-based engine", () => {
});
it("should serve static files", (done) => {
const clientVersion = require("socket.io-client/package.json").version;
const clientVersion = require("../package.json").version;
request(`http://localhost:${port}`)
.get("/socket.io/socket.io.js")