|
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)
|
|
58 | 59 |
|
59 | 60 | # Release notes
|
60 | 61 |
|
| 62 | +## [4.7.0](https://github.com/socketio/socket.io/compare/4.6.2...4.7.0) (2023-06-22) |
| 63 | + |
| 64 | + |
| 65 | +### Bug Fixes |
| 66 | + |
| 67 | +* remove the Partial modifier from the socket.data type ([#4740](https://github.com/socketio/socket.io/issues/4740)) ([e5c62ca](https://github.com/socketio/socket.io/commit/e5c62cad60fc7d16fbb024fd9be1d1880f4e6f5f)) |
| 68 | + |
| 69 | + |
| 70 | +### Features |
| 71 | + |
| 72 | +#### Support for WebTransport |
| 73 | + |
| 74 | +The Engine.IO server can now use WebTransport as the underlying transport. |
| 75 | + |
| 76 | +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. |
| 77 | + |
| 78 | +References: |
| 79 | + |
| 80 | +- https://w3c.github.io/webtransport/ |
| 81 | +- https://developer.mozilla.org/en-US/docs/Web/API/WebTransport |
| 82 | +- https://developer.chrome.com/articles/webtransport/ |
| 83 | + |
| 84 | +Until WebTransport support lands [in Node.js](https://github.com/nodejs/node/issues/38478), you can use the `@fails-components/webtransport` package: |
| 85 | + |
| 86 | +```js |
| 87 | +import { readFileSync } from "fs"; |
| 88 | +import { createServer } from "https"; |
| 89 | +import { Server } from "socket.io"; |
| 90 | +import { Http3Server } from "@fails-components/webtransport"; |
| 91 | + |
| 92 | +// WARNING: the total length of the validity period MUST NOT exceed two weeks (https://w3c.github.io/webtransport/#custom-certificate-requirements) |
| 93 | +const cert = readFileSync("/path/to/my/cert.pem"); |
| 94 | +const key = readFileSync("/path/to/my/key.pem"); |
| 95 | + |
| 96 | +const httpsServer = createServer({ |
| 97 | + key, |
| 98 | + cert |
| 99 | +}); |
| 100 | + |
| 101 | +httpsServer.listen(3000); |
| 102 | + |
| 103 | +const io = new Server(httpsServer, { |
| 104 | + transports: ["polling", "websocket", "webtransport"] // WebTransport is not enabled by default |
| 105 | +}); |
| 106 | + |
| 107 | +const h3Server = new Http3Server({ |
| 108 | + port: 3000, |
| 109 | + host: "0.0.0.0", |
| 110 | + secret: "changeit", |
| 111 | + cert, |
| 112 | + privKey: key, |
| 113 | +}); |
| 114 | + |
| 115 | +(async () => { |
| 116 | + const stream = await h3Server.sessionStream("/engine.io/"); |
| 117 | + const sessionReader = stream.getReader(); |
| 118 | + |
| 119 | + while (true) { |
| 120 | + const { done, value } = await sessionReader.read(); |
| 121 | + if (done) { |
| 122 | + break; |
| 123 | + } |
| 124 | + io.engine.onWebTransportSession(value); |
| 125 | + } |
| 126 | +})(); |
| 127 | + |
| 128 | +h3Server.startServer(); |
| 129 | +``` |
| 130 | + |
| 131 | +Added in [123b68c](https://github.com/socketio/engine.io/commit/123b68c04f9e971f59b526e0f967a488ee6b0116). |
| 132 | + |
| 133 | + |
| 134 | +#### Client bundles with CORS headers |
| 135 | + |
| 136 | +The bundles will now have the right `Access-Control-Allow-xxx` headers. |
| 137 | + |
| 138 | +Added in [63f181c](https://github.com/socketio/socket.io/commit/63f181cc12cbbbf94ed40eef52d60f36a1214fbe). |
| 139 | + |
| 140 | + |
| 141 | +### Dependencies |
| 142 | + |
| 143 | +- [`engine.io@~6.4.2`](https://github.com/socketio/engine.io/releases/tag/6.5.0) ([diff](https://github.com/socketio/engine.io/compare/6.4.2...6.5.0)) |
| 144 | +- [`ws@~8.11.0`](https://github.com/websockets/ws/releases/tag/8.11.0) (no change) |
| 145 | + |
| 146 | + |
| 147 | + |
61 | 148 | ## [4.6.2](https://github.com/socketio/socket.io/compare/4.6.1...4.6.2) (2023-05-31)
|
62 | 149 |
|
63 | 150 |
|
|
0 commit comments