mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-12 00:17:56 -05:00
Compare commits
5 Commits
socket.io-
...
fix/esm-ht
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fad7e65be | ||
|
|
9978574e4f | ||
|
|
e9e5bed4f2 | ||
|
|
9581f9bcfd | ||
|
|
579d43f33f |
@@ -1,12 +0,0 @@
|
||||
const parser = require('.');
|
||||
|
||||
parser.encodePayload([
|
||||
{
|
||||
type: 'message',
|
||||
data: '€',
|
||||
},
|
||||
{
|
||||
type: 'message',
|
||||
data: Buffer.from([1, 2, 3, 4]),
|
||||
},
|
||||
], true, console.log);
|
||||
@@ -1,44 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const browsers = require("socket.io-browsers");
|
||||
|
||||
const zuulConfig = (module.exports = {
|
||||
ui: "mocha-bdd",
|
||||
|
||||
// test on localhost by default
|
||||
local: true,
|
||||
open: true,
|
||||
|
||||
concurrency: 2, // ngrok only accepts two tunnels by default
|
||||
// if browser does not sends output in 120s since last output:
|
||||
// stop testing, something is wrong
|
||||
browser_output_timeout: 120 * 1000,
|
||||
browser_open_timeout: 60 * 4 * 1000,
|
||||
// we want to be notified something is wrong asap, so no retry
|
||||
browser_retries: 1,
|
||||
|
||||
browserify: [
|
||||
{
|
||||
plugin: ["tsify", {
|
||||
target: "es5"
|
||||
}],
|
||||
transform: {
|
||||
name: "babelify",
|
||||
presets: ["@babel/preset-env"]
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
if (process.env.CI === "true") {
|
||||
zuulConfig.local = false;
|
||||
zuulConfig.tunnel = {
|
||||
type: "ngrok",
|
||||
bind_tls: true
|
||||
};
|
||||
}
|
||||
|
||||
const isPullRequest =
|
||||
process.env.TRAVIS_PULL_REQUEST &&
|
||||
process.env.TRAVIS_PULL_REQUEST !== "false";
|
||||
zuulConfig.browsers = isPullRequest ? browsers.pullRequest : browsers.all;
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
| Version | Release date | Bundle size (UMD min+gzip) |
|
||||
|-------------------------------------------------------------------------------------------------------------|----------------|----------------------------|
|
||||
| [4.8.2](#482-2025-12-22) | December 2024 | `14.4 KB` |
|
||||
| [4.8.3](#483-2025-12-23) | December 2025 | `14.4 KB` |
|
||||
| [4.8.2](#482-2025-12-22) | December 2025 | `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` |
|
||||
@@ -51,6 +52,18 @@
|
||||
| [2.1.0](#210-2018-03-29) | March 2018 | `18.7 KB` |
|
||||
|
||||
|
||||
## [4.8.3](https://github.com/socketio/socket.io/compare/socket.io-client@4.8.2...socket.io-client@4.8.3) (2025-12-23)
|
||||
|
||||
There were some minor bug fixes on the server side, which mandate a client bump.
|
||||
|
||||
|
||||
### Dependencies
|
||||
|
||||
- [`engine.io-client@~6.6.1`](https://github.com/socketio/engine.io-client/releases/tag/6.5.2) (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.2](https://github.com/socketio/socket.io/compare/socket.io-client@4.8.1...socket.io-client@4.8.2) (2025-12-22)
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Socket.IO v4.8.2
|
||||
* Socket.IO v4.8.3
|
||||
* (c) 2014-2025 Guillermo Rauch
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
2
packages/socket.io-client/dist/socket.io.js
vendored
2
packages/socket.io-client/dist/socket.io.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Socket.IO v4.8.2
|
||||
* Socket.IO v4.8.3
|
||||
* (c) 2014-2025 Guillermo Rauch
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Socket.IO v4.8.2
|
||||
* Socket.IO v4.8.3
|
||||
* (c) 2014-2025 Guillermo Rauch
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Socket.IO v4.8.2
|
||||
* Socket.IO v4.8.3
|
||||
* (c) 2014-2025 Guillermo Rauch
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "socket.io-client",
|
||||
"version": "4.8.2",
|
||||
"version": "4.8.3",
|
||||
"description": "Realtime application framework client",
|
||||
"keywords": [
|
||||
"realtime",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "socket.io-client",
|
||||
"version": "4.8.2",
|
||||
"version": "4.8.3",
|
||||
"type": "module"
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
| Version | Release date |
|
||||
|--------------------------------------------------------------------------------------------------|----------------|
|
||||
| [4.8.3](#483-2025-12-23) | December 2025 |
|
||||
| [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 |
|
||||
@@ -50,6 +51,21 @@
|
||||
| [2.1.0](#210-2018-03-29) | March 2018 |
|
||||
|
||||
|
||||
## [4.8.3](https://github.com/socketio/socket.io/compare/socket.io@4.8.2...socket.io@4.8.3) (2025-12-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not throw when calling io.close() on a stopped server ([9581f9b](https://github.com/socketio/socket.io/commit/9581f9bcfd0c0fa8cb16eae1604c6a727af21efa))
|
||||
|
||||
|
||||
### 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) (no change)
|
||||
|
||||
|
||||
|
||||
## [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)).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Socket.IO v4.8.2
|
||||
* Socket.IO v4.8.3
|
||||
* (c) 2014-2025 Guillermo Rauch
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Socket.IO v4.8.2
|
||||
* Socket.IO v4.8.3
|
||||
* (c) 2014-2025 Guillermo Rauch
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Socket.IO v4.8.2
|
||||
* Socket.IO v4.8.3
|
||||
* (c) 2014-2025 Guillermo Rauch
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Socket.IO v4.8.2
|
||||
* Socket.IO v4.8.3
|
||||
* (c) 2014-2025 Guillermo Rauch
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import http from "http";
|
||||
import { createServer } from "http"; // 'node:' prefix was added in Node.js 16
|
||||
import type {
|
||||
Server as HTTPServer,
|
||||
IncomingMessage,
|
||||
ServerResponse,
|
||||
} from "http";
|
||||
import type { Server as HTTPSServer } from "https";
|
||||
import type { Http2SecureServer, Http2Server } from "http2";
|
||||
import { createReadStream } from "fs";
|
||||
@@ -58,7 +63,7 @@ type ParentNspNameMatchFn = (
|
||||
type AdapterConstructor = typeof Adapter | ((nsp: Namespace) => Adapter);
|
||||
|
||||
type TServerInstance =
|
||||
| http.Server
|
||||
| HTTPServer
|
||||
| HTTPSServer
|
||||
| Http2SecureServer
|
||||
| Http2Server;
|
||||
@@ -276,8 +281,8 @@ export class Server<
|
||||
*/
|
||||
_connectTimeout: number;
|
||||
private _corsMiddleware: (
|
||||
req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
next: () => void,
|
||||
) => void;
|
||||
|
||||
@@ -301,7 +306,7 @@ export class Server<
|
||||
if (
|
||||
"object" === typeof srv &&
|
||||
srv instanceof Object &&
|
||||
!(srv as Partial<http.Server>).listen
|
||||
!(srv as Partial<HTTPServer>).listen
|
||||
) {
|
||||
opts = srv as Partial<ServerOptions>;
|
||||
srv = undefined;
|
||||
@@ -493,7 +498,7 @@ export class Server<
|
||||
if ("number" == typeof srv) {
|
||||
debug("creating http server and binding to %d", srv);
|
||||
const port = srv;
|
||||
srv = http.createServer((req, res) => {
|
||||
srv = createServer((_req, res) => {
|
||||
res.writeHead(404);
|
||||
res.end();
|
||||
});
|
||||
@@ -591,7 +596,7 @@ export class Server<
|
||||
): void {
|
||||
// initialize engine
|
||||
debug("creating engine.io instance with opts %j", opts);
|
||||
this.eio = attach(srv as http.Server, opts);
|
||||
this.eio = attach(srv as HTTPServer, opts);
|
||||
|
||||
// attach static file serving
|
||||
if (this._serveClient) this.attachServe(srv);
|
||||
@@ -638,7 +643,7 @@ export class Server<
|
||||
* @param res
|
||||
* @private
|
||||
*/
|
||||
private serve(req: http.IncomingMessage, res: http.ServerResponse): void {
|
||||
private serve(req: IncomingMessage, res: ServerResponse): void {
|
||||
const filename = req.url!.replace(this._path, "").replace(/\?.*$/, "");
|
||||
const isMap = dotMapRegex.test(filename);
|
||||
const type = isMap ? "map" : "source";
|
||||
@@ -678,8 +683,8 @@ export class Server<
|
||||
*/
|
||||
private static sendFile(
|
||||
filename: string,
|
||||
req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
): void {
|
||||
const readStream = createReadStream(
|
||||
path.join(__dirname, "../client-dist/", filename),
|
||||
@@ -831,14 +836,13 @@ export class Server<
|
||||
restoreAdapter();
|
||||
|
||||
if (this.httpServer) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
return new Promise<void>((resolve) => {
|
||||
this.httpServer.close((err) => {
|
||||
fn && fn(err);
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
debug("server was not running");
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "socket.io",
|
||||
"version": "4.8.2",
|
||||
"version": "4.8.3",
|
||||
"description": "node.js realtime framework server",
|
||||
"keywords": [
|
||||
"realtime",
|
||||
|
||||
@@ -70,6 +70,27 @@ describe("close", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should not throw when the underlying HTTP server is not running (callback)", (done) => {
|
||||
const httpServer = createServer();
|
||||
const io = new Server(httpServer);
|
||||
|
||||
io.close((err) => {
|
||||
expect((err as Error & { code: string }).code).to.eql(
|
||||
"ERR_SERVER_NOT_RUNNING",
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("should not throw when the underlying HTTP server is not running (Promise)", (done) => {
|
||||
const httpServer = createServer();
|
||||
const io = new Server(httpServer);
|
||||
|
||||
io.close()
|
||||
.then(() => done())
|
||||
.catch((e) => done(e));
|
||||
});
|
||||
|
||||
describe("graceful close", () => {
|
||||
function fixture(filename) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user