Compare commits

..

10 Commits

Author SHA1 Message Date
Damien Arrachequesne
72d61dab82 chore(release): engine.io@6.6.4
Diff: https://github.com/socketio/socket.io/compare/engine.io@6.6.3...engine.io@6.6.4
2025-01-28 09:23:04 +01:00
Damien Arrachequesne
5a31aaf917 chore(eio): revert cookie to version ~0.7.2
This reverts commit 7427109658.

The new version of the `cookie` package contains code with optional chaining (`?.`), which is not supported by older Node.js versions (< 14).

The types for cookie are now bundled, so that there is no conflict with the types coming from `cookie@1`:

> error TS2724: '"cookie"' has no exported member named 'CookieSerializeOptions'. Did you mean 'SerializeOptions'?
>
> import type { CookieSerializeOptions } from "cookie";
>               ~~~~~~~~~~~~~~~~~~~~~~

Related: https://github.com/socketio/socket.io/issues/5283
2025-01-28 09:13:39 +01:00
Damien Arrachequesne
62e4da125e chore(release): engine.io@6.6.3
Diff: https://github.com/socketio/socket.io/compare/engine.io@6.6.2...engine.io@6.6.3
2025-01-23 07:55:43 +01:00
Damien Arrachequesne
bfa6eab195 chore(release): engine.io-client@6.6.3
Diff: https://github.com/socketio/socket.io/compare/engine.io-client@6.6.2...engine.io-client@6.6.3
2025-01-23 07:38:37 +01:00
Ben McCann
7fcddcb3bb fix(engine.io-client): correctly consume the ws package (#5220)
This should fix the following issue:

```
SyntaxError: Named export 'WebSocket' not found. The requested module 'ws' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'ws';
const { WebSocket } = pkg;
```
2025-01-07 10:53:32 +01:00
Damien Arrachequesne
7427109658 refactor(eio): bump cookie to version 1.0.2
Release notes: https://github.com/jshttp/cookie/releases/tag/v1.0.0

The types are now included in the npm package. The `CookieSerializeOptions` type, which is used in our `ServerOptions` type, has been renamed to `SerializeOptions`, but there are no breaking change.

Related: https://github.com/socketio/socket.io/issues/5231
2024-11-21 08:57:37 +01:00
Damien Arrachequesne
91e1c8b358 chore(release): socket.io@4.8.1
Diff: https://github.com/socketio/socket.io/compare/socket.io@4.8.0...socket.io@4.8.1
2024-10-25 08:13:15 +02:00
Damien Arrachequesne
8d5528aa2a chore(release): socket.io-client@4.8.1
Diff: https://github.com/socketio/socket.io/compare/socket.io-client@4.8.0...socket.io-client@4.8.1
2024-10-25 08:00:26 +02:00
Damien Arrachequesne
71387e5294 refactor(sio-client): reexport transports from the engine 2024-10-25 07:54:35 +02:00
Samuel Vogelsanger
aead83560d refactor(sio): make Namespace._fns private (#5196)
Related: https://github.com/socketio/socket.io/issues/5179
2024-10-23 10:59:23 +02:00
36 changed files with 242 additions and 56 deletions

15
package-lock.json generated
View File

@@ -42,6 +42,7 @@
"base64-arraybuffer": "^1.0.2",
"benchmark": "^2.1.4",
"blob": "^0.1.0",
"cookie": "~0.7.2",
"eiows": "^7.1.0",
"engine.io-client-v3": "npm:engine.io-client@^3.5.2",
"expect.js": "^0.3.1",
@@ -2823,11 +2824,6 @@
"@types/responselike": "^1.0.0"
}
},
"node_modules/@types/cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q=="
},
"node_modules/@types/cors": {
"version": "2.8.17",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz",
@@ -15511,10 +15507,9 @@
}
},
"packages/engine.io": {
"version": "6.6.2",
"version": "6.6.3",
"license": "MIT",
"dependencies": {
"@types/cookie": "^0.4.1",
"@types/cors": "^2.8.12",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",
@@ -15530,7 +15525,7 @@
}
},
"packages/engine.io-client": {
"version": "6.6.1",
"version": "6.6.3",
"license": "MIT",
"dependencies": {
"@socket.io/component-emitter": "~3.1.0",
@@ -15572,7 +15567,7 @@
}
},
"packages/socket.io": {
"version": "4.8.0",
"version": "4.8.1",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.4",
@@ -15596,7 +15591,7 @@
}
},
"packages/socket.io-client": {
"version": "4.8.0",
"version": "4.8.1",
"license": "MIT",
"dependencies": {
"@socket.io/component-emitter": "~3.1.0",

View File

@@ -43,6 +43,7 @@
"base64-arraybuffer": "^1.0.2",
"benchmark": "^2.1.4",
"blob": "^0.1.0",
"cookie": "~0.7.2",
"eiows": "^7.1.0",
"engine.io-client-v3": "npm:engine.io-client@^3.5.2",
"expect.js": "^0.3.1",

View File

@@ -2,6 +2,7 @@
| Version | Release date | Bundle size (UMD min+gzip) |
|-------------------------------------------------------------------------------------------------------------|----------------|----------------------------|
| [6.6.3](#663-2025-01-23) | January 2025 | `8.7 KB` |
| [6.6.2](#662-2024-10-23) | October 2024 | `8.7 KB` |
| [6.6.1](#661-2024-09-21) | September 2024 | `8.7 KB` |
| [6.6.0](#660-2024-06-21) | June 2024 | `8.6 KB` |
@@ -40,6 +41,20 @@
# Release notes
## [6.6.3](https://github.com/socketio/socket.io/compare/engine.io-client@6.6.2...engine.io-client@6.6.3) (2025-01-23)
### Bug Fixes
* correctly consume the `ws` package ([#5220](https://github.com/socketio/socket.io/issues/5220)) ([7fcddcb](https://github.com/socketio/socket.io/commit/7fcddcb3bbd236b46aa8fee6f4ce6c45afb7b03a))
### Dependencies
- [`ws@~8.17.1`](https://github.com/websockets/ws/releases/tag/8.17.1) (no change)
## [6.6.2](https://github.com/socketio/socket.io/compare/engine.io-client@6.6.1...engine.io-client@6.6.2) (2024-10-23)

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/*!
* Engine.IO v6.6.2
* (c) 2014-2024 Guillermo Rauch
* Engine.IO v6.6.3
* (c) 2014-2025 Guillermo Rauch
* Released under the MIT License.
*/
(function (global, factory) {

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
import { WebSocket } from "ws";
import * as ws from "ws";
import type { Packet, RawData } from "engine.io-parser";
import { BaseWS } from "./websocket.js";
@@ -27,7 +27,7 @@ export class WS extends BaseWS {
opts.headers.cookie.push(`${name}=${cookie.value}`);
}
}
return new WebSocket(uri, protocols, opts);
return new ws.WebSocket(uri, protocols, opts);
}
doWrite(packet: Packet, data: RawData) {

View File

@@ -2,7 +2,7 @@
"name": "engine.io-client",
"description": "Client for the realtime Engine",
"license": "MIT",
"version": "6.6.2",
"version": "6.6.3",
"main": "./build/cjs/index.js",
"module": "./build/esm/index.js",
"exports": {

View File

@@ -2,6 +2,8 @@
| Version | Release date |
|------------------------------------------------------------------------------------------------------|----------------|
| [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 |
| [6.6.1](#661-2024-09-21) | September 2024 |
| [6.6.0](#660-2024-06-21) | June 2024 |
@@ -47,6 +49,30 @@
# Release notes
## [6.6.4](https://github.com/socketio/socket.io/compare/engine.io@6.6.3...engine.io@6.6.4) (2025-01-28)
The bump of the `cookie` dependency was reverted, as it drops support for older Node.js versions (< 14).
### Dependencies
- [`ws@~8.17.1`](https://github.com/websockets/ws/releases/tag/8.17.1) (no change)
## [6.6.3](https://github.com/socketio/socket.io/compare/engine.io@6.6.2...engine.io@6.6.3) (2025-01-23)
This release contains a bump of the `cookie` dependency.
Release notes: https://github.com/jshttp/cookie/releases/tag/v1.0.0
### Dependencies
- [`ws@~8.17.1`](https://github.com/websockets/ws/releases/tag/8.17.1) (no change)
## [6.6.2](https://github.com/socketio/socket.io/compare/engine.io@6.6.1...engine.io@6.6.2) (2024-10-09)
This release contains a bump of the `cookie` dependency.

View File

@@ -0,0 +1,117 @@
// imported from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/b83cf9ef8b044e69f05b2a00aa7c6cb767a9acd2/types/cookie/index.d.ts (now deleted)
/**
* Basic HTTP cookie parser and serializer for HTTP servers.
*/
/**
* Additional serialization options
*/
export interface CookieSerializeOptions {
/**
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3|Domain Set-Cookie attribute}. By default, no
* domain is set, and most clients will consider the cookie to apply to only
* the current domain.
*/
domain?: string | undefined;
/**
* Specifies a function that will be used to encode a cookie's value. Since
* value of a cookie has a limited character set (and must be a simple
* string), this function can be used to encode a value into a string suited
* for a cookie's value.
*
* The default function is the global `encodeURIComponent`, which will
* encode a JavaScript string into UTF-8 byte sequences and then URL-encode
* any that fall outside of the cookie range.
*/
encode?(value: string): string;
/**
* Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1|`Expires` `Set-Cookie` attribute}. By default,
* no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete
* it on a condition like exiting a web browser application.
*
* *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
* possible not all clients by obey this, so if both are set, they should
* point to the same date and time.
*/
expires?: Date | undefined;
/**
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6|`HttpOnly` `Set-Cookie` attribute}.
* When truthy, the `HttpOnly` attribute is set, otherwise it is not. By
* default, the `HttpOnly` attribute is not set.
*
* *Note* be careful when setting this to true, as compliant clients will
* not allow client-side JavaScript to see the cookie in `document.cookie`.
*/
httpOnly?: boolean | undefined;
/**
* Specifies the number (in seconds) to be the value for the `Max-Age`
* `Set-Cookie` attribute. The given number will be converted to an integer
* by rounding down. By default, no maximum age is set.
*
* *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
* possible not all clients by obey this, so if both are set, they should
* point to the same date and time.
*/
maxAge?: number | undefined;
/**
* Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies)
* attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
* `Partitioned` attribute is not set.
*
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
* This also means many clients may ignore this attribute until they understand it.
*
* More information about can be found in [the proposal](https://github.com/privacycg/CHIPS)
*/
partitioned?: boolean | undefined;
/**
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}.
* By default, the path is considered the "default path".
*/
path?: string | undefined;
/**
* Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1].
*
* - `'low'` will set the `Priority` attribute to `Low`.
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
* - `'high'` will set the `Priority` attribute to `High`.
*
* More information about the different priority levels can be found in
* [the specification][rfc-west-cookie-priority-00-4.1].
*
* **note** This is an attribute that has not yet been fully standardized, and may change in the future.
* This also means many clients may ignore this attribute until they understand it.
*/
priority?: "low" | "medium" | "high" | undefined;
/**
* Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}.
*
* - `true` will set the `SameSite` attribute to `Strict` for strict same
* site enforcement.
* - `false` will not set the `SameSite` attribute.
* - `'lax'` will set the `SameSite` attribute to Lax for lax same site
* enforcement.
* - `'strict'` will set the `SameSite` attribute to Strict for strict same
* site enforcement.
* - `'none'` will set the SameSite attribute to None for an explicit
* cross-site cookie.
*
* More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}.
*
* *note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
*/
sameSite?: true | false | "lax" | "strict" | "none" | undefined;
/**
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5|`Secure` `Set-Cookie` attribute}. When truthy, the
* `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
*
* *Note* be careful when setting this to `true`, as compliant clients will
* not send the cookie back to the server in the future if the browser does
* not have an HTTPS connection.
*/
secure?: boolean | undefined;
}

View File

@@ -12,12 +12,12 @@ import type {
Server as HttpServer,
ServerResponse,
} from "http";
import type { CookieSerializeOptions } from "cookie";
import type { CorsOptions, CorsOptionsDelegate } from "cors";
import type { Duplex } from "stream";
import { WebTransport } from "./transports/webtransport";
import { createPacketDecoderStream } from "engine.io-parser";
import type { EngineRequest } from "./transport";
import type { CookieSerializeOptions } from "./contrib/types.cookie";
const debug = debugModule("engine");

View File

@@ -1,6 +1,6 @@
{
"name": "engine.io",
"version": "6.6.2",
"version": "6.6.4",
"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",
@@ -31,7 +31,6 @@
],
"license": "MIT",
"dependencies": {
"@types/cookie": "^0.4.1",
"@types/cors": "^2.8.12",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",

View File

@@ -2,6 +2,7 @@
| Version | Release date | Bundle size (UMD min+gzip) |
|-------------------------------------------------------------------------------------------------------------|----------------|----------------------------|
| [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` |
| [4.7.4](#474-2024-01-12) | January 2024 | `14.5 KB` |
@@ -51,7 +52,22 @@
# Release notes
# [4.8.0](https://github.com/socketio/socket.io/compare/socket.io-client@4.7.5...socket.io-client@4.8.0) (2024-09-21)
## [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)
### Bug Fixes
* **bundle:** do not mangle the "_placeholder" attribute ([ca9e994](https://github.com/socketio/socket.io/commit/ca9e994815aa2e31e0342e37ccdc2e9e8c5fd13c))
### 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.0](https://github.com/socketio/socket.io/compare/socket.io-client@4.7.5...socket.io-client@4.8.0) (2024-09-21)
### Features

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,5 +1,5 @@
/*!
* Socket.IO v4.8.0
* Socket.IO v4.8.1
* (c) 2014-2024 Guillermo Rauch
* Released under the MIT License.
*/
@@ -1432,6 +1432,7 @@
};
_proto.doClose = function doClose() {
if (typeof this.ws !== "undefined") {
this.ws.onerror = function () {};
this.ws.close();
this.ws = null;
}

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

@@ -99,3 +99,12 @@ export {
lookup as connect,
lookup as default,
};
export {
Fetch,
NodeXHR,
XHR,
NodeWebSocket,
WebSocket,
WebTransport,
} from "engine.io-client";

View File

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

View File

@@ -2,6 +2,7 @@
| Version | Release date |
|--------------------------------------------------------------------------------------------------|----------------|
| [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 |
| [4.7.4](#474-2024-01-12) | January 2024 |
@@ -50,6 +51,18 @@
# Release notes
## [4.8.1](https://github.com/socketio/socket.io/compare/socket.io@4.8.0...socket.io@4.8.1) (2024-10-25)
Due to a change in the bundler configuration, the production bundle (`socket.io.min.js`) did not support sending and receiving binary data in version `4.8.0`. This is now fixed.
### Dependencies
- [`engine.io@~6.6.0`](https://github.com/socketio/engine.io/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.0](https://github.com/socketio/socket.io/compare/socket.io@4.7.5...socket.io@4.8.0) (2024-09-21)

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,5 +1,5 @@
/*!
* Socket.IO v4.8.0
* Socket.IO v4.8.1
* (c) 2014-2024 Guillermo Rauch
* Released under the MIT License.
*/
@@ -1432,6 +1432,7 @@
};
_proto.doClose = function doClose() {
if (typeof this.ws !== "undefined") {
this.ws.onerror = function () {};
this.ws.close();
this.ws = null;
}

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

@@ -161,7 +161,7 @@ export class Namespace<
SocketData
>;
protected _fns: Array<
private _fns: Array<
(
socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>,
next: (err?: ExtendedError) => void,

View File

@@ -67,7 +67,7 @@ export class ParentNamespace<
): Namespace<ListenEvents, EmitEvents, ServerSideEvents, SocketData> {
debug("creating child namespace %s", name);
const namespace = new Namespace(this.server, name);
this._fns.forEach((fn) => namespace.use(fn));
this["_fns"].forEach((fn) => namespace.use(fn));
this.listeners("connect").forEach((listener) =>
namespace.on("connect", listener),
);

View File

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

View File

@@ -1,13 +1,6 @@
"use strict";
import expect from "expect.js";
describe("socket.io", () => {
it("should be the same version as client", () => {
const version = require("../package").version;
expect(version).to.be(require("socket.io-client/package.json").version);
});
require("./server-attachment");
require("./handshake");
require("./close");