|
| 1 | +# [3.0.0-rc1](https://github.com/socketio/socket.io/compare/2.3.0...3.0.0-rc1) (2020-10-13) |
| 2 | + |
| 3 | + |
| 4 | +### Features |
| 5 | + |
| 6 | +* add ES6 module export ([8b6b100](https://github.com/socketio/socket.io/commit/8b6b100c284ccce7d85e55659e3397f533916847)) |
| 7 | +* do not reuse the Engine.IO id ([2875d2c](https://github.com/socketio/socket.io/commit/2875d2cfdfa463e64cb520099749f543bbc4eb15)) |
| 8 | +* remove Server#set() method ([029f478](https://github.com/socketio/socket.io/commit/029f478992f59b1eb5226453db46363a570eea46)) |
| 9 | +* remove Socket#rooms object ([1507b41](https://github.com/socketio/socket.io/commit/1507b416d584381554d1ed23c9aaf3b650540071)) |
| 10 | +* remove the 'origins' option ([a8c0600](https://github.com/socketio/socket.io/commit/a8c06006098b512ba1b8b8df82777349db486f41)) |
| 11 | +* remove the implicit connection to the default namespace ([3289f7e](https://github.com/socketio/socket.io/commit/3289f7ec376e9ec88c2f90e2735c8ca8d01c0e97)) |
| 12 | +* throw upon reserved event names ([4bd5b23](https://github.com/socketio/socket.io/commit/4bd5b2339a66a5a675e20f689fff2e70ff12d236)) |
| 13 | + |
| 14 | + |
| 15 | +### BREAKING CHANGES |
| 16 | + |
| 17 | +* the 'origins' option is removed |
| 18 | + |
| 19 | +Before: |
| 20 | + |
| 21 | +```js |
| 22 | +new Server(3000, { |
| 23 | + origins: ["https://example.com"] |
| 24 | +}); |
| 25 | +``` |
| 26 | + |
| 27 | +The 'origins' option was used in the allowRequest method, in order to |
| 28 | +determine whether the request should pass or not. And the Engine.IO |
| 29 | +server would implicitly add the necessary Access-Control-Allow-xxx |
| 30 | +headers. |
| 31 | + |
| 32 | +After: |
| 33 | + |
| 34 | +```js |
| 35 | +new Server(3000, { |
| 36 | + cors: { |
| 37 | + origin: "https://example.com", |
| 38 | + methods: ["GET", "POST"], |
| 39 | + allowedHeaders: ["content-type"] |
| 40 | + } |
| 41 | +}); |
| 42 | +``` |
| 43 | + |
| 44 | +The already existing 'allowRequest' option can be used for validation: |
| 45 | + |
| 46 | +```js |
| 47 | +new Server(3000, { |
| 48 | + allowRequest: (req, callback) => { |
| 49 | + callback(null, req.headers.referer.startsWith("https://example.com")); |
| 50 | + } |
| 51 | +}); |
| 52 | +``` |
| 53 | + |
| 54 | +* Socket#rooms is now a Set instead of an object |
| 55 | + |
| 56 | +* Namespace#connected is now a Map instead of an object |
| 57 | + |
| 58 | +* there is no more implicit connection to the default namespace: |
| 59 | + |
| 60 | +```js |
| 61 | +// client-side |
| 62 | +const socket = io("/admin"); |
| 63 | + |
| 64 | +// server-side |
| 65 | +io.on("connect", socket => { |
| 66 | + // not triggered anymore |
| 67 | +}) |
| 68 | + |
| 69 | +io.use((socket, next) => { |
| 70 | + // not triggered anymore |
| 71 | +}); |
| 72 | + |
| 73 | +io.of("/admin").use((socket, next) => { |
| 74 | + // triggered |
| 75 | +}); |
| 76 | +``` |
| 77 | + |
| 78 | +* the Server#set() method was removed |
| 79 | + |
| 80 | +This method was kept for backward-compatibility with pre-1.0 versions. |
| 81 | + |
0 commit comments