|
2 | 2 |
|
3 | 3 | ## 2023
|
4 | 4 |
|
| 5 | +- [4.7.0](#470-2023-06-22) (Jun 2023) |
5 | 6 | - [4.6.2](#462-2023-05-31) (May 2023)
|
6 | 7 | - [4.6.1](#461-2023-02-20) (Feb 2023)
|
7 | 8 | - [4.6.0](#460-2023-02-07) (Feb 2023)
|
|
59 | 60 |
|
60 | 61 | # Release notes
|
61 | 62 |
|
| 63 | +## [4.7.0](https://github.com/socketio/socket.io-client/compare/4.6.2...4.7.0) (2023-06-22) |
| 64 | + |
| 65 | + |
| 66 | +### Bug Fixes |
| 67 | + |
| 68 | +* properly report timeout error when connecting ([5bc94b5](https://github.com/socketio/socket.io-client/commit/5bc94b56bc1788bab16d9d514d2c8abf3b1d8f87)) |
| 69 | +* use same scope for setTimeout and clearTimeout calls ([#1568](https://github.com/socketio/socket.io-client/issues/1568)) ([f2892ab](https://github.com/socketio/socket.io-client/commit/f2892aba0beeae7c9be930221655d7da6094c5f1)) |
| 70 | + |
| 71 | + |
| 72 | +### Features |
| 73 | + |
| 74 | +#### Support for WebTransport |
| 75 | + |
| 76 | +The Engine.IO client can now use WebTransport as the underlying transport. |
| 77 | + |
| 78 | +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. |
| 79 | + |
| 80 | +References: |
| 81 | + |
| 82 | +- https://w3c.github.io/webtransport/ |
| 83 | +- https://developer.mozilla.org/en-US/docs/Web/API/WebTransport |
| 84 | +- https://developer.chrome.com/articles/webtransport/ |
| 85 | + |
| 86 | +**For Node.js clients**: until WebTransport support lands [in Node.js](https://github.com/nodejs/node/issues/38478), you can use the `@fails-components/webtransport` package: |
| 87 | + |
| 88 | +```js |
| 89 | +import { WebTransport } from "@fails-components/webtransport"; |
| 90 | + |
| 91 | +global.WebTransport = WebTransport; |
| 92 | +``` |
| 93 | + |
| 94 | +Added in [7195c0f](https://github.com/socketio/engine.io-client/commit/7195c0f305b482f7b1ca2ed812030caaf72c0906). |
| 95 | + |
| 96 | +#### Cookie management for the Node.js client |
| 97 | + |
| 98 | +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. |
| 99 | + |
| 100 | +```js |
| 101 | +import { io } from "socket.io-client"; |
| 102 | + |
| 103 | +const socket = io("https://example.com", { |
| 104 | + withCredentials: true |
| 105 | +}); |
| 106 | +``` |
| 107 | + |
| 108 | +Added in [5fc88a6](https://github.com/socketio/engine.io-client/commit/5fc88a62d4017cdc144fa39b9755deadfff2db34). |
| 109 | + |
| 110 | +#### Conditional import of the ESM build with debug logs |
| 111 | + |
| 112 | +By default, the ESM build does not include the `debug` package in the browser environments, because it increases the bundle size (see [16b6569](https://github.com/socketio/socket.io-client/commit/16b65698aed766e1e645c78847f2e91bfc5b6f56)). |
| 113 | + |
| 114 | +Which means that, unfortunately, debug logs are not available in the devtools console, even when setting the `localStorage.debug = ...` attribute. |
| 115 | + |
| 116 | +You can now import the build which includes the `debug` packages with a [conditional import](https://nodejs.org/api/packages.html#conditional-exports). Example with vite: |
| 117 | + |
| 118 | +```js |
| 119 | +import { defineConfig } from 'vite' |
| 120 | +import react from '@vitejs/plugin-react' |
| 121 | + |
| 122 | +export default defineConfig({ |
| 123 | + plugins: [react()], |
| 124 | + server: { |
| 125 | + port: 4000 |
| 126 | + }, |
| 127 | + resolve: { |
| 128 | + conditions: ["development"] |
| 129 | + } |
| 130 | +}) |
| 131 | +``` |
| 132 | + |
| 133 | +Reference: https://v2.vitejs.dev/config/#resolve-conditions |
| 134 | + |
| 135 | +Added in [781d753](https://github.com/socketio/socket.io-client/commit/781d753a626d01e675056a2ff4e27f5dd599564f). |
| 136 | + |
| 137 | + |
| 138 | +### Dependencies |
| 139 | + |
| 140 | +- [`engine.io-client@~6.5.0`](https://github.com/socketio/engine.io-client/releases/tag/6.5.0) ([diff](https://github.com/socketio/engine.io-client/compare/6.4.0...6.5.0)) |
| 141 | +- [`ws@~8.11.0`](https://github.com/websockets/ws/releases/tag/8.11.0) (no change) |
| 142 | + |
| 143 | + |
| 144 | + |
62 | 145 | ## [4.6.2](https://github.com/socketio/socket.io-client/compare/4.6.1...4.6.2) (2023-05-31)
|
63 | 146 |
|
64 | 147 |
|
|
0 commit comments