Version | Release date | Bundle size (UMD min+gzip) |
---|---|---|
6.6.0 | June 2024 | 8.6 KB |
6.5.4 (from the 6.5.x branch) | June 2024 | 8.8 KB |
3.5.4 (from the 3.5.x branch) | June 2024 | - |
6.5.3 | November 2023 | 8.8 KB |
6.5.2 | August 2023 | 8.8 KB |
6.5.1 | June 2023 | 8.4 KB |
6.5.0 | June 2023 | 7.8 KB |
6.4.0 | February 2023 | 7.8 KB |
6.3.1 | February 2023 | 7.8 KB |
6.3.0 | January 2023 | 8.0 KB |
6.2.3 | October 2022 | 7.8 KB |
3.5.3 | September 2022 | - |
6.2.2 | May 2022 | 7.8 KB |
6.2.1 | April 2022 | 7.8 KB |
6.2.0 | April 2022 | 7.8 KB |
6.0.3 (from the 6.0.x branch) | November 2021 | 7.4 KB |
6.1.1 | November 2021 | 7.4 KB |
6.1.0 | November 2021 | 7.4 KB |
6.0.2 | October 2021 | 7.4 KB |
6.0.1 | October 2021 | 7.4 KB |
6.0.0 | October 2021 | 7.5 KB |
5.2.0 | August 2021 | 9.4 KB |
5.1.2 | June 2021 | 9.3 KB |
5.1.1 | May 2021 | 9.2 KB |
4.1.4 (from the 4.1.x branch) | May 2021 | 9.1 KB |
3.5.2 (from the 3.5.x branch) | May 2021 | - |
5.1.0 | May 2021 | 9.2 KB |
5.0.1 | March 2021 | 9.2 KB |
5.0.0 | March 2021 | 9.3 KB |
3.5.1 (from the 3.5.x branch) | March 2021 | - |
4.1.2 | February 2021 | 9.2 KB |
4.1.1 | February 2021 | 9.1 KB |
4.1.0 | January 2021 | 9.1 KB |
6.6.0 (2024-06-21)
The transports
option now accepts an array of transport implementations:
import { Socket, XHR, WebSocket } from "engine.io-client";
const socket = new Socket({
transports: [XHR, WebSocket]
});
Here is the list of provided implementations:
Transport | Description |
---|---|
Fetch |
HTTP long-polling based on the built-in fetch() method. |
NodeXHR |
HTTP long-polling based on the XMLHttpRequest object provided by the xmlhttprequest-ssl package. |
XHR |
HTTP long-polling based on the built-in XMLHttpRequest object. |
NodeWebSocket |
WebSocket transport based on the WebSocket object provided by the ws package. |
WebSocket |
WebSocket transport based on the built-in WebSocket object. |
WebTransport |
WebTransport transport based on the built-in WebTransport object. |
Usage:
Transport | browser | Node.js | Deno | Bun |
---|---|---|---|---|
Fetch |
✅ | ✅ (1) | ✅ | ✅ |
NodeXHR |
✅ | ✅ | ✅ | |
XHR |
✅ | |||
NodeWebSocket |
✅ | ✅ | ✅ | |
WebSocket |
✅ | ✅ (2) | ✅ | ✅ |
WebTransport |
✅ | ✅ |
(1) since v18.0.0 (2) since v21.0.0
The feature above also comes with the ability to exclude the code related to unused transports (a.k.a. "tree-shaking"):
import { SocketWithoutUpgrade, WebSocket } from "engine.io-client";
const socket = new SocketWithoutUpgrade({
transports: [WebSocket]
});
In that case, the code related to HTTP long-polling and WebTransport will be excluded from the final bundle.
Added in f4d898e
When setting the tryAllTransports
option to true
, if the first transport (usually, HTTP long-polling) fails, then the other transports will be tested too:
import { Socket } from "engine.io-client";
const socket = new Socket({
tryAllTransports: true
});
This feature is useful in two cases:
- when HTTP long-polling is disabled on the server, or if CORS fails
- when WebSocket is tested first (with
transports: ["websocket", "polling"]
)
The only potential downside is that the connection attempt could take more time in case of failure, as there have been reports of WebSocket connection errors taking several seconds before being detected (that's one reason for using HTTP long-polling first). That's why the option defaults to false
for now.
Added in 579b243.
- add some randomness to the cache busting string generator (b624c50)
- fix cookie management with WebSocket (Node.js only) (e105551)
ws@~8.17.1
(no change)
6.5.4 (2024-06-18)
This release contains a bump of the ws
dependency, which includes an important security fix.
Advisory: https://github.com/advisories/GHSA-3h5v-q93c-6h6q
3.5.4 (2024-06-18)
This release contains a bump of the ws
dependency, which includes an important security fix.
Advisory: https://github.com/advisories/GHSA-3h5v-q93c-6h6q
6.5.3 (2023-11-09)
- add a maximum length for the URL (707597d)
- improve compatibility with node16 module resolution (#711) (46ef851)
ws@~8.11.0
(no change)
6.5.2 (2023-08-01)
ws@~8.11.0
(no change)
6.5.1 (2023-06-28)
- make closeOnBeforeunload default to false (a63066b)
- webtransport: properly handle abruptly closed connections (cf6aa1f)
ws@~8.11.0
(no change)
6.5.0 (2023-06-16)
The Engine.IO client can now use WebTransport as the underlying transport.
WebTransport is a web API that uses the HTTP/3 protocol as a bidirectional transport. It's intended for two-way communications between a web client and an HTTP/3 server.
References:
- https://w3c.github.io/webtransport/
- https://developer.mozilla.org/en-US/docs/Web/API/WebTransport
- https://developer.chrome.com/articles/webtransport/
For Node.js clients: until WebTransport support lands in Node.js, you can use the @fails-components/webtransport
package:
import { WebTransport } from "@fails-components/webtransport";
global.WebTransport = WebTransport;
Added in 7195c0f.
When setting the withCredentials
option to true
, the Node.js client will now include the cookies in the HTTP requests, making it easier to use it with cookie-based sticky sessions.
import { Socket } from "engine.io-client";
const socket = new Socket("https://example.com", {
withCredentials: true
});
Added in 5fc88a6.
ws@~8.11.0
(no change)
6.4.0 (2023-02-06)
The minor bump is due to changes on the server side.
ws@~8.11.0
(no change)
6.3.1 (2023-02-04)
- typings: do not expose browser-specific types (37d7a0a)
ws@~8.11.0
(no change)
6.3.0 (2023-01-10)
- properly parse relative URL with a "@" character (12b7d78)
- use explicit context for setTimeout function (#699) (047f420)
The trailing slash which was added by default can now be disabled:
import { Socket } from "engine.io-client";
const socket = new Socket("https://example.com", {
addTrailingSlash: false
});
In the example above, the request URL will be https://example.com/engine.io
instead of https://example.com/engine.io/
.
6.2.3 (2022-10-13)
- properly clear "beforeunload" event listener (99925a4)
ws@~8.2.3
(no change)
3.5.3 (2022-09-07)
- fix usage with vite (280de36)
ws@~7.4.2
(no change)
6.2.2 (2022-05-02)
- simplify the check for WebSocket availability (f158c8e)
This check was added for the flashsocket transport, which has been deprecated for a while now ([1]). But it fails with latest webpack versions, as the expression "__initialize" in WebSocket
gets evaluated to true
.
Default export of globalThis seems to have a problem in the "browser" field when the library is loaded asynchronously with webpack.
6.2.1 (2022-04-17)
6.2.0 (2022-04-17)
- add details to the "close" event (b9252e2)
The close event will now include additional details to help debugging if anything has gone wrong.
Example when a payload is over the maxHttpBufferSize value in HTTP long-polling mode:
socket.on("close", (reason, details) => {
console.log(reason); // "transport error"
// in that case, details is an error object
console.log(details.message); "xhr post error"
console.log(details.description); // 413 (the HTTP status of the response)
// details.context refers to the XMLHttpRequest object
console.log(details.context.status); // 413
console.log(details.context.responseText); // ""
});
Note: the error object was already included before this commit and is kept for backward compatibility.
- slice write buffer according to the maxPayload value (46fdc2f)
The server will now include a "maxPayload" field in the handshake details, allowing the clients to decide how many packets they have to send to stay under the maxHttpBufferSize value.
6.0.3 (2021-11-14)
Some bug fixes were backported from master, to be included by the latest socket.io-client
version.
6.1.1 (2021-11-14)
6.1.0 (2021-11-08)
The minor bump is due to changes on the server side.
- typings: allow any value in the query option (018e1af)
- typings: allow port to be a number (#680) (8f68f77)
6.0.2 (2021-10-15)
- bundle: fix vite build (faa9f31)
6.0.1 (2021-10-14)
- fix usage with vite (4971914)
6.0.0 (2021-10-08)
This major release contains three important changes:
- the codebase was migrated to TypeScript (7245b80)
- rollup is now used instead of webpack to create the bundles (27de300)
- code that provided support for ancient browsers (think IE8) was removed (c656192 and b2c7381)
There is now three distinct builds (in the build/ directory):
- CommonJS
- ESM with debug
- ESM without debug (rationale here: 00d7e7d)
And three bundles (in the dist/ directory) :
engine.io.js
: unminified UMD bundleengine.io.min.js
: minified UMD bundleengine.io.esm.min.js
: ESM bundle
Please note that the communication protocol was not updated, so a v5 client will be able to reach a v6 server (and vice-versa).
Reference: https://github.com/socketio/engine.io-protocol
- provide an ESM build without debug (00d7e7d)
ws
version: ~8.2.3
5.2.0 (2021-08-29)
5.1.2 (2021-06-24)
- emit ping when receiving a ping from the server (589d3ad)
- websocket: fix timer blocking writes (#670) (f30a10b)
5.1.1 (2021-05-11)
- fix JSONP transport on IE9 (bddd992)
4.1.4 (2021-05-05)
This release only contains a bump of xmlhttprequest-ssl
, in order to fix the following vulnerability: https://www.npmjs.com/advisories/1665.
Please note that engine.io-client
was not directly impacted by this vulnerability, since we are always using async: true
.
3.5.2 (2021-05-05)
This release only contains a bump of xmlhttprequest-ssl
, in order to fix the following vulnerability: https://www.npmjs.com/advisories/1665.
Please note that engine.io-client
was not directly impacted by this vulnerability, since we are always using async: true
.
5.1.0 (2021-05-04)
- add the "closeOnBeforeunload" option (dcb85e9)
5.0.1 (2021-03-31)
- ignore packets when the transport is silently closed (d291a4c)
5.0.0 (2021-03-10)
The major bump is due to a breaking change on the server side.
3.5.1 (2021-03-02)
- replace default nulls in SSL options with undefineds (d0c551c)
4.1.2 (2021-02-25)
- silently close the transport in the beforeunload hook (ed48b5d)
4.1.1 (2021-02-02)
- remove polyfill for process in the bundle (c95fdea)
4.1.0 (2021-01-14)
- add missing ws options (d134fee)
4.0.6 (2021-01-04)
3.5.0 (2020-12-30)
- check the type of the initial packet (8750356)
4.0.5 (2020-12-07)
4.0.4 (2020-11-17)
- check the type of the initial packet (1c8cba8)
- restore the cherry-picking of the WebSocket options (4873a23)
4.0.3 (2020-11-17)
- react-native: add a default value for the withCredentials option (ccb99e3)
- react-native: exclude the localAddress option (177b95f)
4.0.2 (2020-11-09)
4.0.1 (2020-10-21)
3.4.4 (2020-09-30)
4.0.0 (2020-09-10)
More details about this release in the blog post: https://socket.io/blog/engine-io-4-release/
- react-native: restrict the list of options for the WebSocket object (2f5c948)
- use globalThis polyfill instead of self/global (#634) (3f3a6f9)
- strip debug from the browser bundle (f7ba966)
- Diff: v4.0.0-alpha.1...4.0.0
- Full diff: 3.4.0...4.0.0
- Server release: 4.0.0
- ws version: ~7.2.1
3.4.1 (2020-04-17)
- use globalThis polyfill instead of self/global (357f01d)
- Diff: 3.4.0...3.4.1
- Server release: 3.4.1
- ws version: ~6.1.0
4.0.0-alpha.1 (2020-02-12)
- properly assign options when creating the transport (7c7f1a9)
- Diff: v4.0.0-alpha.0...v4.0.0-alpha.1
- Server release: v4.0.0-alpha.1
- ws version: ~7.2.1
4.0.0-alpha.0 (2020-02-12)
- migrate to webpack 4 (11dc4f3)
- reverse the ping-pong mechanism (81d7171)
-
v3.x clients will not be able to connect anymore (they will send a ping packet and timeout while waiting for a pong packet).
-
the output bundle will now be found in the dist/ folder.
- Diff: 3.4.0...v4.0.0-alpha.0
- Server release: v4.0.0-alpha.0
- ws version: ~7.2.1