[6a3a178] | 1 | ## [3.1.2](https://github.com/socketio/socket.io/compare/3.1.1...3.1.2) (2021-02-26)
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | ### Bug Fixes
|
---|
| 5 |
|
---|
| 6 | * ignore packets received after disconnection ([494c64e](https://github.com/socketio/socket.io/commit/494c64e44f645cbd24c645f1186d203789e84af0))
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | ## [3.1.1](https://github.com/socketio/socket.io/compare/3.1.0...3.1.1) (2021-02-03)
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 | ### Bug Fixes
|
---|
| 13 |
|
---|
| 14 | * properly parse the CONNECT packet in v2 compatibility mode ([6f4bd7f](https://github.com/socketio/socket.io/commit/6f4bd7f8e7c41a075a8014565330a77c38b03a8d))
|
---|
| 15 | * **typings:** add return types and general-case overload signatures ([#3776](https://github.com/socketio/socket.io/issues/3776)) ([9e8f288](https://github.com/socketio/socket.io/commit/9e8f288ca9f14f91064b8d3cce5946f7d23d407c))
|
---|
| 16 | * **typings:** update the types of "query", "auth" and "headers" ([4f2e9a7](https://github.com/socketio/socket.io/commit/4f2e9a716d9835b550c8fd9a9b429ebf069c2895))
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | # [3.1.0](https://github.com/socketio/socket.io/compare/3.0.5...3.1.0) (2021-01-15)
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | ### Features
|
---|
| 23 |
|
---|
| 24 | * confirm a weak but matching ETag ([#3485](https://github.com/socketio/socket.io/issues/3485)) ([161091d](https://github.com/socketio/socket.io/commit/161091dd4c9e1b1610ac3d45d964195e63d92b94))
|
---|
| 25 | * **esm:** export the Namespace and Socket class ([#3699](https://github.com/socketio/socket.io/issues/3699)) ([233650c](https://github.com/socketio/socket.io/commit/233650c22209708b5fccc4349c38d2fa1b465d8f))
|
---|
| 26 | * add support for Socket.IO v2 clients ([9925746](https://github.com/socketio/socket.io/commit/9925746c8ee3a6522bd640b5d586c83f04f2f1ba))
|
---|
| 27 | * add room events ([155fa63](https://github.com/socketio/socket.io-adapter/commit/155fa6333a504036e99a33667dc0397f6aede25e))
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | ### Bug Fixes
|
---|
| 31 |
|
---|
| 32 | * allow integers as event names ([1c220dd](https://github.com/socketio/socket.io-parser/commit/1c220ddbf45ea4b44bc8dbf6f9ae245f672ba1b9))
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | ## [3.0.5](https://github.com/socketio/socket.io/compare/3.0.4...3.0.5) (2021-01-05)
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | ### Bug Fixes
|
---|
| 39 |
|
---|
| 40 | * properly clear timeout on connection failure ([170b739](https://github.com/socketio/socket.io/commit/170b739f147cb6c92b423729b877e242e376927d))
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | ### Reverts
|
---|
| 44 |
|
---|
| 45 | * restore the socket middleware functionality ([bf54327](https://github.com/socketio/socket.io/commit/bf5432742158e4d5ba2722cff4a614967dffa5b9))
|
---|
| 46 |
|
---|
| 47 |
|
---|
| 48 | ## [3.0.4](https://github.com/socketio/socket.io/compare/3.0.3...3.0.4) (2020-12-07)
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | ## [3.0.3](https://github.com/socketio/socket.io/compare/3.0.2...3.0.3) (2020-11-19)
|
---|
| 52 |
|
---|
| 53 |
|
---|
| 54 | ## [3.0.2](https://github.com/socketio/socket.io/compare/3.0.1...3.0.2) (2020-11-17)
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | ### Bug Fixes
|
---|
| 58 |
|
---|
| 59 | * merge Engine.IO options ([43705d7](https://github.com/socketio/socket.io/commit/43705d7a9149833afc69edc937ea7f8c9aabfeef))
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | ## [3.0.1](https://github.com/socketio/socket.io/compare/3.0.0...3.0.1) (2020-11-09)
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | ### Bug Fixes
|
---|
| 66 |
|
---|
| 67 | * export ServerOptions and Namespace types ([#3684](https://github.com/socketio/socket.io/issues/3684)) ([f62f180](https://github.com/socketio/socket.io/commit/f62f180edafdd56d8a8a277e092bc66df0c5f07f))
|
---|
| 68 | * **typings:** update the signature of the emit method ([50671d9](https://github.com/socketio/socket.io/commit/50671d984a81535a6a15c704546ca7465e2ea295))
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | # [3.0.0](https://github.com/socketio/socket.io/compare/2.3.0...3.0.0) (2020-11-05)
|
---|
| 72 |
|
---|
| 73 | ### Bug Fixes
|
---|
| 74 |
|
---|
| 75 | * close clients with no namespace ([91cd255](https://github.com/socketio/socket.io/commit/91cd255ba76ff6a780c62740f9f5cd3a76f5d7c7))
|
---|
| 76 |
|
---|
| 77 | ### Features
|
---|
| 78 |
|
---|
| 79 | * emit an Error object upon middleware error ([54bf4a4](https://github.com/socketio/socket.io/commit/54bf4a44e9e896dfb64764ee7bd4e8823eb7dc7b))
|
---|
| 80 | * serve msgpack bundle ([aa7574f](https://github.com/socketio/socket.io/commit/aa7574f88471aa30ae472a5cddf1000a8baa70fd))
|
---|
| 81 | * add support for catch-all listeners ([5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))
|
---|
| 82 | * make Socket#join() and Socket#leave() synchronous ([129c641](https://github.com/socketio/socket.io/commit/129c6417bd818bc8b4e1b831644323876e627c13))
|
---|
| 83 | * remove prod dependency to socket.io-client ([7603da7](https://github.com/socketio/socket.io/commit/7603da71a535481e3fc60e38b013abf78516d322))
|
---|
| 84 | * move binary detection back to the parser ([669592d](https://github.com/socketio/socket.io/commit/669592d120409a5cf00f128070dee6d22259ba4f))
|
---|
| 85 | * add ES6 module export ([8b6b100](https://github.com/socketio/socket.io/commit/8b6b100c284ccce7d85e55659e3397f533916847))
|
---|
| 86 | * do not reuse the Engine.IO id ([2875d2c](https://github.com/socketio/socket.io/commit/2875d2cfdfa463e64cb520099749f543bbc4eb15))
|
---|
| 87 | * remove Server#set() method ([029f478](https://github.com/socketio/socket.io/commit/029f478992f59b1eb5226453db46363a570eea46))
|
---|
| 88 | * remove Socket#rooms object ([1507b41](https://github.com/socketio/socket.io/commit/1507b416d584381554d1ed23c9aaf3b650540071))
|
---|
| 89 | * remove the 'origins' option ([a8c0600](https://github.com/socketio/socket.io/commit/a8c06006098b512ba1b8b8df82777349db486f41))
|
---|
| 90 | * remove the implicit connection to the default namespace ([3289f7e](https://github.com/socketio/socket.io/commit/3289f7ec376e9ec88c2f90e2735c8ca8d01c0e97))
|
---|
| 91 | * throw upon reserved event names ([4bd5b23](https://github.com/socketio/socket.io/commit/4bd5b2339a66a5a675e20f689fff2e70ff12d236))
|
---|
| 92 |
|
---|
| 93 | ### BREAKING CHANGES
|
---|
| 94 |
|
---|
| 95 | * the Socket#use() method is removed (see [5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))
|
---|
| 96 |
|
---|
| 97 | * Socket#join() and Socket#leave() do not accept a callback argument anymore.
|
---|
| 98 |
|
---|
| 99 | Before:
|
---|
| 100 |
|
---|
| 101 | ```js
|
---|
| 102 | socket.join("room1", () => {
|
---|
| 103 | io.to("room1").emit("hello");
|
---|
| 104 | });
|
---|
| 105 | ```
|
---|
| 106 |
|
---|
| 107 | After:
|
---|
| 108 |
|
---|
| 109 | ```js
|
---|
| 110 | socket.join("room1");
|
---|
| 111 | io.to("room1").emit("hello");
|
---|
| 112 | // or await socket.join("room1"); for custom adapters
|
---|
| 113 | ```
|
---|
| 114 |
|
---|
| 115 | * the "connected" map is renamed to "sockets"
|
---|
| 116 | * the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.
|
---|
| 117 | * the 'origins' option is removed
|
---|
| 118 |
|
---|
| 119 | Before:
|
---|
| 120 |
|
---|
| 121 | ```js
|
---|
| 122 | new Server(3000, {
|
---|
| 123 | origins: ["https://example.com"]
|
---|
| 124 | });
|
---|
| 125 | ```
|
---|
| 126 |
|
---|
| 127 | The 'origins' option was used in the allowRequest method, in order to
|
---|
| 128 | determine whether the request should pass or not. And the Engine.IO
|
---|
| 129 | server would implicitly add the necessary Access-Control-Allow-xxx
|
---|
| 130 | headers.
|
---|
| 131 |
|
---|
| 132 | After:
|
---|
| 133 |
|
---|
| 134 | ```js
|
---|
| 135 | new Server(3000, {
|
---|
| 136 | cors: {
|
---|
| 137 | origin: "https://example.com",
|
---|
| 138 | methods: ["GET", "POST"],
|
---|
| 139 | allowedHeaders: ["content-type"]
|
---|
| 140 | }
|
---|
| 141 | });
|
---|
| 142 | ```
|
---|
| 143 |
|
---|
| 144 | The already existing 'allowRequest' option can be used for validation:
|
---|
| 145 |
|
---|
| 146 | ```js
|
---|
| 147 | new Server(3000, {
|
---|
| 148 | allowRequest: (req, callback) => {
|
---|
| 149 | callback(null, req.headers.referer.startsWith("https://example.com"));
|
---|
| 150 | }
|
---|
| 151 | });
|
---|
| 152 | ```
|
---|
| 153 |
|
---|
| 154 | * Socket#rooms is now a Set instead of an object
|
---|
| 155 |
|
---|
| 156 | * Namespace#connected is now a Map instead of an object
|
---|
| 157 |
|
---|
| 158 | * there is no more implicit connection to the default namespace:
|
---|
| 159 |
|
---|
| 160 | ```js
|
---|
| 161 | // client-side
|
---|
| 162 | const socket = io("/admin");
|
---|
| 163 |
|
---|
| 164 | // server-side
|
---|
| 165 | io.on("connect", socket => {
|
---|
| 166 | // not triggered anymore
|
---|
| 167 | })
|
---|
| 168 |
|
---|
| 169 | io.use((socket, next) => {
|
---|
| 170 | // not triggered anymore
|
---|
| 171 | });
|
---|
| 172 |
|
---|
| 173 | io.of("/admin").use((socket, next) => {
|
---|
| 174 | // triggered
|
---|
| 175 | });
|
---|
| 176 | ```
|
---|
| 177 |
|
---|
| 178 | * the Server#set() method was removed
|
---|
| 179 |
|
---|
| 180 | This method was kept for backward-compatibility with pre-1.0 versions.
|
---|
| 181 |
|
---|
| 182 |
|
---|
| 183 | # [3.0.0-rc4](https://github.com/socketio/socket.io/compare/3.0.0-rc3...3.0.0-rc4) (2020-10-30)
|
---|
| 184 |
|
---|
| 185 |
|
---|
| 186 | ### Features
|
---|
| 187 |
|
---|
| 188 | * emit an Error object upon middleware error ([54bf4a4](https://github.com/socketio/socket.io/commit/54bf4a44e9e896dfb64764ee7bd4e8823eb7dc7b))
|
---|
| 189 | * serve msgpack bundle ([aa7574f](https://github.com/socketio/socket.io/commit/aa7574f88471aa30ae472a5cddf1000a8baa70fd))
|
---|
| 190 |
|
---|
| 191 |
|
---|
| 192 |
|
---|
| 193 | # [3.0.0-rc3](https://github.com/socketio/socket.io/compare/3.0.0-rc2...3.0.0-rc3) (2020-10-26)
|
---|
| 194 |
|
---|
| 195 |
|
---|
| 196 | ### Features
|
---|
| 197 |
|
---|
| 198 | * add support for catch-all listeners ([5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))
|
---|
| 199 | * make Socket#join() and Socket#leave() synchronous ([129c641](https://github.com/socketio/socket.io/commit/129c6417bd818bc8b4e1b831644323876e627c13))
|
---|
| 200 | * remove prod dependency to socket.io-client ([7603da7](https://github.com/socketio/socket.io/commit/7603da71a535481e3fc60e38b013abf78516d322))
|
---|
| 201 |
|
---|
| 202 |
|
---|
| 203 | ### BREAKING CHANGES
|
---|
| 204 |
|
---|
| 205 | * the Socket#use() method is removed (see [5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))
|
---|
| 206 |
|
---|
| 207 | * Socket#join() and Socket#leave() do not accept a callback argument anymore.
|
---|
| 208 |
|
---|
| 209 | Before:
|
---|
| 210 |
|
---|
| 211 | ```js
|
---|
| 212 | socket.join("room1", () => {
|
---|
| 213 | io.to("room1").emit("hello");
|
---|
| 214 | });
|
---|
| 215 | ```
|
---|
| 216 |
|
---|
| 217 | After:
|
---|
| 218 |
|
---|
| 219 | ```js
|
---|
| 220 | socket.join("room1");
|
---|
| 221 | io.to("room1").emit("hello");
|
---|
| 222 | // or await socket.join("room1"); for custom adapters
|
---|
| 223 | ```
|
---|
| 224 |
|
---|
| 225 |
|
---|
| 226 |
|
---|
| 227 | # [3.0.0-rc2](https://github.com/socketio/socket.io/compare/3.0.0-rc1...3.0.0-rc2) (2020-10-15)
|
---|
| 228 |
|
---|
| 229 |
|
---|
| 230 | ### Bug Fixes
|
---|
| 231 |
|
---|
| 232 | * close clients with no namespace ([91cd255](https://github.com/socketio/socket.io/commit/91cd255ba76ff6a780c62740f9f5cd3a76f5d7c7))
|
---|
| 233 |
|
---|
| 234 |
|
---|
| 235 | ### Code Refactoring
|
---|
| 236 |
|
---|
| 237 | * remove duplicate _sockets map ([8a5db7f](https://github.com/socketio/socket.io/commit/8a5db7fa36a075da75cde43cd4fb6382b7659953))
|
---|
| 238 |
|
---|
| 239 |
|
---|
| 240 | ### Features
|
---|
| 241 |
|
---|
| 242 | * move binary detection back to the parser ([669592d](https://github.com/socketio/socket.io/commit/669592d120409a5cf00f128070dee6d22259ba4f))
|
---|
| 243 |
|
---|
| 244 |
|
---|
| 245 | ### BREAKING CHANGES
|
---|
| 246 |
|
---|
| 247 | * the "connected" map is renamed to "sockets"
|
---|
| 248 | * the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.
|
---|
| 249 |
|
---|
| 250 |
|
---|
| 251 |
|
---|
| 252 | # [3.0.0-rc1](https://github.com/socketio/socket.io/compare/2.3.0...3.0.0-rc1) (2020-10-13)
|
---|
| 253 |
|
---|
| 254 |
|
---|
| 255 | ### Features
|
---|
| 256 |
|
---|
| 257 | * add ES6 module export ([8b6b100](https://github.com/socketio/socket.io/commit/8b6b100c284ccce7d85e55659e3397f533916847))
|
---|
| 258 | * do not reuse the Engine.IO id ([2875d2c](https://github.com/socketio/socket.io/commit/2875d2cfdfa463e64cb520099749f543bbc4eb15))
|
---|
| 259 | * remove Server#set() method ([029f478](https://github.com/socketio/socket.io/commit/029f478992f59b1eb5226453db46363a570eea46))
|
---|
| 260 | * remove Socket#rooms object ([1507b41](https://github.com/socketio/socket.io/commit/1507b416d584381554d1ed23c9aaf3b650540071))
|
---|
| 261 | * remove the 'origins' option ([a8c0600](https://github.com/socketio/socket.io/commit/a8c06006098b512ba1b8b8df82777349db486f41))
|
---|
| 262 | * remove the implicit connection to the default namespace ([3289f7e](https://github.com/socketio/socket.io/commit/3289f7ec376e9ec88c2f90e2735c8ca8d01c0e97))
|
---|
| 263 | * throw upon reserved event names ([4bd5b23](https://github.com/socketio/socket.io/commit/4bd5b2339a66a5a675e20f689fff2e70ff12d236))
|
---|
| 264 |
|
---|
| 265 |
|
---|
| 266 | ### BREAKING CHANGES
|
---|
| 267 |
|
---|
| 268 | * the 'origins' option is removed
|
---|
| 269 |
|
---|
| 270 | Before:
|
---|
| 271 |
|
---|
| 272 | ```js
|
---|
| 273 | new Server(3000, {
|
---|
| 274 | origins: ["https://example.com"]
|
---|
| 275 | });
|
---|
| 276 | ```
|
---|
| 277 |
|
---|
| 278 | The 'origins' option was used in the allowRequest method, in order to
|
---|
| 279 | determine whether the request should pass or not. And the Engine.IO
|
---|
| 280 | server would implicitly add the necessary Access-Control-Allow-xxx
|
---|
| 281 | headers.
|
---|
| 282 |
|
---|
| 283 | After:
|
---|
| 284 |
|
---|
| 285 | ```js
|
---|
| 286 | new Server(3000, {
|
---|
| 287 | cors: {
|
---|
| 288 | origin: "https://example.com",
|
---|
| 289 | methods: ["GET", "POST"],
|
---|
| 290 | allowedHeaders: ["content-type"]
|
---|
| 291 | }
|
---|
| 292 | });
|
---|
| 293 | ```
|
---|
| 294 |
|
---|
| 295 | The already existing 'allowRequest' option can be used for validation:
|
---|
| 296 |
|
---|
| 297 | ```js
|
---|
| 298 | new Server(3000, {
|
---|
| 299 | allowRequest: (req, callback) => {
|
---|
| 300 | callback(null, req.headers.referer.startsWith("https://example.com"));
|
---|
| 301 | }
|
---|
| 302 | });
|
---|
| 303 | ```
|
---|
| 304 |
|
---|
| 305 | * Socket#rooms is now a Set instead of an object
|
---|
| 306 |
|
---|
| 307 | * Namespace#connected is now a Map instead of an object
|
---|
| 308 |
|
---|
| 309 | * there is no more implicit connection to the default namespace:
|
---|
| 310 |
|
---|
| 311 | ```js
|
---|
| 312 | // client-side
|
---|
| 313 | const socket = io("/admin");
|
---|
| 314 |
|
---|
| 315 | // server-side
|
---|
| 316 | io.on("connect", socket => {
|
---|
| 317 | // not triggered anymore
|
---|
| 318 | })
|
---|
| 319 |
|
---|
| 320 | io.use((socket, next) => {
|
---|
| 321 | // not triggered anymore
|
---|
| 322 | });
|
---|
| 323 |
|
---|
| 324 | io.of("/admin").use((socket, next) => {
|
---|
| 325 | // triggered
|
---|
| 326 | });
|
---|
| 327 | ```
|
---|
| 328 |
|
---|
| 329 | * the Server#set() method was removed
|
---|
| 330 |
|
---|
| 331 | This method was kept for backward-compatibility with pre-1.0 versions.
|
---|
| 332 |
|
---|