Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: socketio/socket.io
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.5.0
Choose a base ref
...
head repository: socketio/socket.io
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.0.0
Choose a head ref

Commits on Apr 14, 2020

  1. Copy the full SHA
    b74bb80 View commit details
  2. Copy the full SHA
    edb95ea View commit details
  3. 1
    Copy the full SHA
    281de9e View commit details

Commits on Apr 17, 2020

  1. Copy the full SHA
    17747e4 View commit details
  2. Copy the full SHA
    2a1aa1c View commit details

Commits on May 22, 2020

  1. Copy the full SHA
    8f90ba9 View commit details

Commits on Jun 4, 2020

  1. docs(examples/webpack-build-server): update engine.io version

    In order to include [0], which fixes the following error:
    
    ERROR in ./node_modules/engine.io/lib/server.js
    Module not found: Error: Can't resolve 'uws' in '/media/damien/git/other-bets/socket.io-parent/socket.io/examples/webpack-build-server/node_modules/engine.io/lib'
     @ ./node_modules/engine.io/lib/server.js 107:27-41
     @ ./node_modules/engine.io/lib/engine.io.js
     @ ./node_modules/socket.io/lib/index.js
     @ ./lib/index.js
    
    [0] socketio/engine.io@85e544a
    darrachequesne committed Jun 4, 2020
    Copy the full SHA
    5d16319 View commit details

Commits on Jun 5, 2020

  1. Copy the full SHA
    7a219f9 View commit details
  2. Copy the full SHA
    f5a8f52 View commit details

Commits on Jul 9, 2020

  1. Copy the full SHA
    a66f083 View commit details

Commits on Sep 1, 2020

  1. docs: points towards the website

    The website is now much more stable, so there's no need to keep two
    copies of the same content (which must be manually kept in sync).
    darrachequesne committed Sep 1, 2020
    Copy the full SHA
    e0b35d0 View commit details

Commits on Sep 17, 2020

  1. Copy the full SHA
    1238ddb View commit details
  2. test: add Node.js 12 and 14 in the build matrix

    Node.js 8 is removed, as it is now EOL.
    
    Note: the node_modules folder is cached by default
    darrachequesne committed Sep 17, 2020
    Copy the full SHA
    d9bfcae View commit details
  3. Copy the full SHA
    13cc07d View commit details
  4. Copy the full SHA
    3d760b7 View commit details

Commits on Sep 19, 2020

  1. Copy the full SHA
    af165ae View commit details

Commits on Sep 25, 2020

  1. Copy the full SHA
    a5581a9 View commit details
  2. Copy the full SHA
    2464de7 View commit details
  3. chore: bump socket.io-adapter

    Breaking changes:
    
    - Namespace#connected is now a Map instead of an object.
    
    - Namespace#clients() is renamed to Namespace#allSockets() and now
    returns a Promise
    
    Diff: socketio/socket.io-adapter@1.1.2...2.0.0
    darrachequesne committed Sep 25, 2020
    Copy the full SHA
    84437dc View commit details
  4. feat: remove Socket#rooms object

    The value stored in the adapter will now be used, instead of
    duplicating it in the Socket class.
    
    Breaking change: Socket#rooms is now a Set instead of an object
    
    Closes #2890
    darrachequesne committed Sep 25, 2020
    Copy the full SHA
    1507b41 View commit details
  5. refactor: use ES6 Maps instead of plain objects

    These attributes were not part of the public API, so there's no
    breaking change.
    darrachequesne committed Sep 25, 2020
    Copy the full SHA
    424a473 View commit details
  6. feat: remove Server#set() method

    This method was kept for backward-compatibility with pre-1.0 versions.
    darrachequesne committed Sep 25, 2020
    Copy the full SHA
    029f478 View commit details

Commits on Sep 28, 2020

  1. chore: bump socket.io-parser

    Breaking change:
    
    - the encode() method is now synchronous
    
    Please note that the exchange [protocol][1] is left untouched and thus
    stays in version 4.
    
    Diff: socketio/socket.io-parser@3.4.1...4.0.0
    
    [1] https://github.com/socketio/socket.io-protocol
    darrachequesne committed Sep 28, 2020
    Copy the full SHA
    1108ede View commit details

Commits on Sep 29, 2020

  1. Copy the full SHA
    0540c36 View commit details

Commits on Oct 4, 2020

  1. Copy the full SHA
    bb43ff2 View commit details

Commits on Oct 13, 2020

  1. chore: point towards the develop branch of the client

    The package-lock.json file is temporarily removed in order to include
    the latest commits to the client and make the tests pass.
    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    4396bd0 View commit details
  2. Copy the full SHA
    64bd9fb View commit details
  3. Copy the full SHA
    7a51c76 View commit details
  4. feat: remove the implicit connection to the default namespace

    In previous versions, a client was always connected to the default
    namespace, even if it requested access to another namespace.
    
    This meant that the middlewares registered for the default namespace
    were triggered in any case, which is a surprising behavior for end
    users.
    
    This also meant that the query option of the Socket on the client-side
    was not sent in the Socket.IO CONNECT packet for the default namespace:
    
    ```js
    // default namespace: query sent in the query params
    const socket = io({
      query: {
        abc: "def"
      }
    });
    
    // another namespace: query sent in the query params + the CONNECT packet
    const socket = io("/admin", {
      query: {
        abc: "def"
      }
    });
    ```
    
    The client will now send a CONNECT packet in any case, and the query
    option of the Socket is renamed to "auth", in order to make a clear
    distinction with the query option of the Manager (included in the query
    parameters of the HTTP requests).
    
    ```js
    // server-side
    io.use((socket, next) => {
      // not triggered anymore
    });
    
    io.of("/admin").use((socket, next => {
      // triggered
      console.log(socket.handshake.query.abc); // "def"
      console.log(socket.handshake.auth.abc); // "123"
    });
    
    // client-side
    const socket = io("/admin", {
      query: {
        abc: "def"
      },
      auth: {
        abc: "123"
      }
    });
    ```
    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    3289f7e View commit details
  5. feat: do not reuse the Engine.IO id

    In previous versions, the Socket#id attribute was equal (or derived,
    for a non-default namespace) to the underlying Engine.IO id, which is
    used as a mean to authenticate the user throughout the Engine.IO
    session and thus is sensitive information that should be kept secret.
    
    The problem with reusing the Engine.IO id is that users could be
    tempted to transmit this id to other clients, in order to implement
    private messaging for example.
    
    So we'll now generate a new random id for each new socket.
    
    Please note that this id will now be different from the one found in
    the query parameters of the HTTP requests.
    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    2875d2c View commit details
  6. Copy the full SHA
    83a2356 View commit details
  7. feat: add ES6 module export

    Both CommonJS and ES6 import are now supported:
    
    - with `{ "type": "commonjs" }` in the package.json file
    
    ```js
    const io = require("socket.io")(8080);
    // or
    const { Server } = require("socket.io");
    const io = new Server(8080);
    ```
    
    - with `{ "type": "module" }`
    
    ```js
    import { Server } from "socket.io";
    
    const io = new Server(8080);
    ```
    
    Related: https://nodejs.org/api/packages.html#packages_dual_commonjs_es_module_packages
    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    8b6b100 View commit details
  8. feat: remove the 'origins' option

    The underlying Engine.IO server now supports a 'cors' option, which
    will be forwarded to the cors module.
    
    Breaking change: the 'origins' option is removed
    
    Before:
    
    ```js
    new Server(3000, {
      origins: ["https://example.com"]
    });
    ```
    
    The 'origins' option was used in the allowRequest method, in order to
    determine whether the request should pass or not. And the Engine.IO
    server would implicitly add the necessary Access-Control-Allow-xxx
    headers.
    
    After:
    
    ```js
    new Server(3000, {
      cors: {
        origin: "https://example.com",
        methods: ["GET", "POST"],
        allowedHeaders: ["content-type"]
      }
    });
    ```
    
    The already existing 'allowRequest' option can be used for validation:
    
    ```js
    new Server(3000, {
      allowRequest: (req, callback) => {
        callback(null, req.headers.referer.startsWith("https://example.com"));
      }
    });
    ```
    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    a8c0600 View commit details
  9. feat: throw upon reserved event names

    These events cannot be used by the end users, because they are part of
    the Socket.IO public API, so using them will now throw an error
    explicitly.
    darrachequesne committed Oct 13, 2020
    Copy the full SHA
    4bd5b23 View commit details
  10. Copy the full SHA
    9c7a48d View commit details
  11. Copy the full SHA
    c0d171f View commit details
  12. Copy the full SHA
    ebb0575 View commit details
  13. Copy the full SHA
    2d2a31e View commit details

Commits on Oct 15, 2020

  1. feat: move binary detection back to the parser

    See socketio/socket.io-parser@285e7cd
    
    Breaking change: the Socket#binary() method is removed, as this use
    case is now covered by the ability to provide your own parser.
    darrachequesne committed Oct 15, 2020
    Copy the full SHA
    669592d View commit details
  2. refactor: hide internal methods and properties

    There is no concept of package-private methods in TypeScript, so we'll
    just prefix them with "_" and mark them as private in the JSDoc.
    darrachequesne committed Oct 15, 2020
    Copy the full SHA
    58b66f8 View commit details
  3. fix: close clients with no namespace

    After a given timeout, a client that did not join any namespace will be
    closed in order to prevent malicious clients from using the server
    resources.
    
    The timeout defaults to 45 seconds, in order not to interfere with the
    Engine.IO heartbeat mechanism (30 seconds).
    darrachequesne committed Oct 15, 2020
    Copy the full SHA
    91cd255 View commit details
  4. Copy the full SHA
    2a05042 View commit details
  5. refactor: remove duplicate _sockets map

    Both the "connected" and the "_sockets" maps were used to track the
    Socket instances in the namespace.
    
    Let's merge them into "sockets". It's a breaking change, but:
    
    - the "sockets" object did already exist in Socket.IO v2 (and appears in some examples/tutorials)
    - "sockets" makes more sense than "connected" in my opinion
    - there was already a breaking change regarding the "connected" property (from object to Map)
    
    Breaking change: the "connected" map is renamed to "sockets"
    darrachequesne committed Oct 15, 2020
    Copy the full SHA
    8a5db7f View commit details
  6. Copy the full SHA
    0ce5b4c View commit details
  7. Copy the full SHA
    20ea6bd View commit details
  8. docs(examples): add example with TypeScript

    There are two issues with the typings:
    
    - on the client-side, the Emitter class is not properly imported (hence the @ts-ignore)
    - on the server-side, the Socket class is not exported (in order to cast it in the "connect" event)
    darrachequesne committed Oct 15, 2020
    Copy the full SHA
    a81b9f3 View commit details

Commits on Oct 17, 2020

  1. feat: remove prod dependency to socket.io-client

    The client bundles are included in the repository in order to remove
    socket.io-client from the list of production dependencies and thus to
    reduce the total number of dependencies when installing the server.
    
    This means the release of the client and the server must now be in sync
    (which is almost always the case actually).
    
    The minified build is now served:
    
    - /<path>/socket.io.js
    - /<path>/socket.io.js.map
    - /<path>/socket.io.min.js
    - /<path>/socket.io.min.js.map
    
    The content will now be compressed as well.
    darrachequesne committed Oct 17, 2020
    Copy the full SHA
    7603da7 View commit details
  2. refactor(typings): export Socket class

    In order to be able to cast it on the argument of the "connect" event:
    
    ```js
    import { Socket } from "socket.io";
    
    io.on("connect", (socket: Socket) => {
      // ...
    });
    ```
    darrachequesne committed Oct 17, 2020
    Copy the full SHA
    0d74f29 View commit details

Commits on Oct 21, 2020

  1. feat: make Socket#join() and Socket#leave() synchronous

    Depending on the adapter, Socket#join() may return:
    
    - nothing (in-memory and Redis adapters)
    - a promise (custom adapters)
    
    Breaking change: Socket#join() and Socket#leave() do not accept a
    callback argument anymore.
    
    Before:
    
    ```js
    socket.join("room1", () => {
     io.to("room1").emit("hello");
    });
    ```
    
    After:
    
    ```
    socket.join("room1");
    io.to("room1").emit("hello");
    // or await socket.join("room1"); for custom adapters
    ```
    
    Note: the need for an asynchronous method came from the Redis adapter,
    which did override the Adapter#add() method in earlier versions, but
    this is not the case anymore.
    
    Reference:
    
    - https://github.com/socketio/socket.io/blob/2.3.0/lib/socket.js#L236-L258
    - https://github.com/socketio/socket.io-adapter/blob/1.1.2/index.js#L56-L65
    - socketio/socket.io-redis-adapter@05f926e
    
    Related: #3662
    darrachequesne committed Oct 21, 2020
    Copy the full SHA
    129c641 View commit details

Commits on Oct 25, 2020

  1. feat: add support for catch-all listeners

    Inspired from EventEmitter2 [1]
    
    ```js
    io.on("connect", socket => {
    
      socket.onAny((event, ...args) => {});
    
      socket.prependAny((event, ...args) => {});
    
      socket.offAny(); // remove all listeners
    
      socket.offAny(listener);
    
      const listeners = socket.listenersAny();
    });
    ```
    
    Breaking change: the socket.use() method is removed
    
    This method was introduced in [2] for the same feature (having a
    catch-all listener), but there were two issues:
    
    - the API is not very user-friendly, since the user has to know the structure of the packet argument
    - it uses an ERROR packet, which is reserved for Namespace authentication issues (see [3])
    
    [1]: https://github.com/EventEmitter2/EventEmitter2
    [2]: #434
    [3]: https://github.com/socketio/socket.io-protocol
    darrachequesne committed Oct 25, 2020
    2
    Copy the full SHA
    5c73733 View commit details
Showing with 37,264 additions and 5,164 deletions.
  1. +2 −2 .gitignore
  2. +2 −4 .travis.yml
  3. +262 −0 CHANGELOG.md
  4. +17 −2 Readme.md
  5. +6,161 −0 client-dist/socket.io.js
  6. +1 −0 client-dist/socket.io.js.map
  7. +7 −0 client-dist/socket.io.min.js
  8. +1 −0 client-dist/socket.io.min.js.map
  9. +7 −0 client-dist/socket.io.msgpack.min.js
  10. +1 −0 client-dist/socket.io.msgpack.min.js.map
  11. +0 −880 docs/API.md
  12. +1 −14 docs/README.md
  13. +0 −64 docs/emit.md
  14. +1 −4 examples/chat/README.md
  15. +1 −1 examples/chat/index.js
  16. +706 −0 examples/chat/package-lock.json
  17. +2 −1 examples/chat/package.json
  18. +23 −0 examples/create-react-app-example/.gitignore
  19. +72 −0 examples/create-react-app-example/README.md
  20. +37 −0 examples/create-react-app-example/package.json
  21. BIN examples/create-react-app-example/public/favicon.ico
  22. +43 −0 examples/create-react-app-example/public/index.html
  23. BIN examples/create-react-app-example/public/logo192.png
  24. BIN examples/create-react-app-example/public/logo512.png
  25. +25 −0 examples/create-react-app-example/public/manifest.json
  26. +3 −0 examples/create-react-app-example/public/robots.txt
  27. +19 −0 examples/create-react-app-example/server.js
  28. +38 −0 examples/create-react-app-example/src/App.css
  29. +43 −0 examples/create-react-app-example/src/App.js
  30. +9 −0 examples/create-react-app-example/src/App.test.js
  31. +13 −0 examples/create-react-app-example/src/index.css
  32. +17 −0 examples/create-react-app-example/src/index.js
  33. +7 −0 examples/create-react-app-example/src/logo.svg
  34. +141 −0 examples/create-react-app-example/src/serviceWorker.js
  35. +5 −0 examples/create-react-app-example/src/setupTests.js
  36. +11,106 −0 examples/create-react-app-example/yarn.lock
  37. +17 −0 examples/es-modules/README.md
  38. +18 −0 examples/es-modules/client.js
  39. +238 −0 examples/es-modules/package-lock.json
  40. +15 −0 examples/es-modules/package.json
  41. +16 −0 examples/es-modules/server.js
  42. +14 −0 examples/passport-example/README.md
  43. BIN examples/passport-example/assets/passport_example.gif
  44. +31 −0 examples/passport-example/index.html
  45. +104 −0 examples/passport-example/index.js
  46. +24 −0 examples/passport-example/login.html
  47. +783 −0 examples/passport-example/package-lock.json
  48. +16 −0 examples/passport-example/package.json
  49. +4 −0 examples/react-native/.expo-shared/assets.json
  50. +14 −0 examples/react-native/.gitignore
  51. +71 −0 examples/react-native/App.js
  52. +16 −0 examples/react-native/README.md
  53. +28 −0 examples/react-native/app.json
  54. BIN examples/react-native/assets/icon.png
  55. BIN examples/react-native/assets/react-native-demo.gif
  56. BIN examples/react-native/assets/react-native.png
  57. BIN examples/react-native/assets/splash.png
  58. +6 −0 examples/react-native/babel.config.js
  59. +6,775 −0 examples/react-native/package-lock.json
  60. +24 −0 examples/react-native/package.json
  61. +15 −0 examples/react-native/server.js
  62. +30 −0 examples/tweet-stream/index.js
  63. +705 −0 examples/tweet-stream/package-lock.json
  64. +20 −0 examples/tweet-stream/package.json
  65. +19 −0 examples/typescript/client.ts
  66. +268 −0 examples/typescript/package-lock.json
  67. +17 −0 examples/typescript/package.json
  68. +16 −0 examples/typescript/server.ts
  69. +4,137 −0 examples/webpack-build-server/package-lock.json
  70. +3 −2 examples/webpack-build-server/package.json
  71. +1 −1 examples/whiteboard/README.md
  72. +706 −0 examples/whiteboard/package-lock.json
  73. +2 −2 examples/whiteboard/package.json
  74. +0 −273 lib/client.js
  75. +278 −0 lib/client.ts
  76. +0 −523 lib/index.js
  77. +715 −0 lib/index.ts
  78. +0 −299 lib/namespace.js
  79. +291 −0 lib/namespace.ts
  80. +0 −39 lib/parent-namespace.js
  81. +40 −0 lib/parent-namespace.ts
  82. +0 −572 lib/socket.js
  83. +595 −0 lib/socket.ts
  84. +36 −11 package.json
  85. +0 −11 test/fixtures/server-close.js
  86. +11 −0 test/fixtures/server-close.ts
  87. +0 −2,459 test/socket.io.js
  88. +2,334 −0 test/socket.io.ts
  89. +22 −0 test/support/util.ts
  90. +13 −0 tsconfig.json
  91. +3 −0 wrapper.mjs
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -10,5 +10,5 @@ benchmarks/*.png
node_modules
coverage
.idea
dist
.nyc_output
.nyc_output
dist/
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
language: node_js
sudo: false
node_js:
- '8'
- '10'
- '12'
- '14'
notifications:
irc: "irc.freenode.org#socket.io"
git:
depth: 1
cache:
directories:
- node_modules
262 changes: 262 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
# [3.0.0](https://github.com/socketio/socket.io/compare/2.3.0...3.0.0) (2020-11-05)

### Bug Fixes

* close clients with no namespace ([91cd255](https://github.com/socketio/socket.io/commit/91cd255ba76ff6a780c62740f9f5cd3a76f5d7c7))

### Features

* emit an Error object upon middleware error ([54bf4a4](https://github.com/socketio/socket.io/commit/54bf4a44e9e896dfb64764ee7bd4e8823eb7dc7b))
* serve msgpack bundle ([aa7574f](https://github.com/socketio/socket.io/commit/aa7574f88471aa30ae472a5cddf1000a8baa70fd))
* add support for catch-all listeners ([5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))
* make Socket#join() and Socket#leave() synchronous ([129c641](https://github.com/socketio/socket.io/commit/129c6417bd818bc8b4e1b831644323876e627c13))
* remove prod dependency to socket.io-client ([7603da7](https://github.com/socketio/socket.io/commit/7603da71a535481e3fc60e38b013abf78516d322))
* move binary detection back to the parser ([669592d](https://github.com/socketio/socket.io/commit/669592d120409a5cf00f128070dee6d22259ba4f))
* add ES6 module export ([8b6b100](https://github.com/socketio/socket.io/commit/8b6b100c284ccce7d85e55659e3397f533916847))
* do not reuse the Engine.IO id ([2875d2c](https://github.com/socketio/socket.io/commit/2875d2cfdfa463e64cb520099749f543bbc4eb15))
* remove Server#set() method ([029f478](https://github.com/socketio/socket.io/commit/029f478992f59b1eb5226453db46363a570eea46))
* remove Socket#rooms object ([1507b41](https://github.com/socketio/socket.io/commit/1507b416d584381554d1ed23c9aaf3b650540071))
* remove the 'origins' option ([a8c0600](https://github.com/socketio/socket.io/commit/a8c06006098b512ba1b8b8df82777349db486f41))
* remove the implicit connection to the default namespace ([3289f7e](https://github.com/socketio/socket.io/commit/3289f7ec376e9ec88c2f90e2735c8ca8d01c0e97))
* throw upon reserved event names ([4bd5b23](https://github.com/socketio/socket.io/commit/4bd5b2339a66a5a675e20f689fff2e70ff12d236))

### BREAKING CHANGES

* the Socket#use() method is removed (see [5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))

* Socket#join() and Socket#leave() do not accept a callback argument anymore.

Before:

```js
socket.join("room1", () => {
io.to("room1").emit("hello");
});
```

After:

```js
socket.join("room1");
io.to("room1").emit("hello");
// or await socket.join("room1"); for custom adapters
```

* the "connected" map is renamed to "sockets"
* the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.
* the 'origins' option is removed

Before:

```js
new Server(3000, {
origins: ["https://example.com"]
});
```

The 'origins' option was used in the allowRequest method, in order to
determine whether the request should pass or not. And the Engine.IO
server would implicitly add the necessary Access-Control-Allow-xxx
headers.

After:

```js
new Server(3000, {
cors: {
origin: "https://example.com",
methods: ["GET", "POST"],
allowedHeaders: ["content-type"]
}
});
```

The already existing 'allowRequest' option can be used for validation:

```js
new Server(3000, {
allowRequest: (req, callback) => {
callback(null, req.headers.referer.startsWith("https://example.com"));
}
});
```

* Socket#rooms is now a Set instead of an object

* Namespace#connected is now a Map instead of an object

* there is no more implicit connection to the default namespace:

```js
// client-side
const socket = io("/admin");

// server-side
io.on("connect", socket => {
// not triggered anymore
})

io.use((socket, next) => {
// not triggered anymore
});

io.of("/admin").use((socket, next) => {
// triggered
});
```

* the Server#set() method was removed

This method was kept for backward-compatibility with pre-1.0 versions.


# [3.0.0-rc4](https://github.com/socketio/socket.io/compare/3.0.0-rc3...3.0.0-rc4) (2020-10-30)


### Features

* emit an Error object upon middleware error ([54bf4a4](https://github.com/socketio/socket.io/commit/54bf4a44e9e896dfb64764ee7bd4e8823eb7dc7b))
* serve msgpack bundle ([aa7574f](https://github.com/socketio/socket.io/commit/aa7574f88471aa30ae472a5cddf1000a8baa70fd))



# [3.0.0-rc3](https://github.com/socketio/socket.io/compare/3.0.0-rc2...3.0.0-rc3) (2020-10-26)


### Features

* add support for catch-all listeners ([5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))
* make Socket#join() and Socket#leave() synchronous ([129c641](https://github.com/socketio/socket.io/commit/129c6417bd818bc8b4e1b831644323876e627c13))
* remove prod dependency to socket.io-client ([7603da7](https://github.com/socketio/socket.io/commit/7603da71a535481e3fc60e38b013abf78516d322))


### BREAKING CHANGES

* the Socket#use() method is removed (see [5c73733](https://github.com/socketio/socket.io/commit/5c737339858d59eab4b5ee2dd6feff0e82c4fe5a))

* Socket#join() and Socket#leave() do not accept a callback argument anymore.

Before:

```js
socket.join("room1", () => {
io.to("room1").emit("hello");
});
```

After:

```js
socket.join("room1");
io.to("room1").emit("hello");
// or await socket.join("room1"); for custom adapters
```



# [3.0.0-rc2](https://github.com/socketio/socket.io/compare/3.0.0-rc1...3.0.0-rc2) (2020-10-15)


### Bug Fixes

* close clients with no namespace ([91cd255](https://github.com/socketio/socket.io/commit/91cd255ba76ff6a780c62740f9f5cd3a76f5d7c7))


### Code Refactoring

* remove duplicate _sockets map ([8a5db7f](https://github.com/socketio/socket.io/commit/8a5db7fa36a075da75cde43cd4fb6382b7659953))


### Features

* move binary detection back to the parser ([669592d](https://github.com/socketio/socket.io/commit/669592d120409a5cf00f128070dee6d22259ba4f))


### BREAKING CHANGES

* the "connected" map is renamed to "sockets"
* the Socket#binary() method is removed, as this use case is now covered by the ability to provide your own parser.



# [3.0.0-rc1](https://github.com/socketio/socket.io/compare/2.3.0...3.0.0-rc1) (2020-10-13)


### Features

* add ES6 module export ([8b6b100](https://github.com/socketio/socket.io/commit/8b6b100c284ccce7d85e55659e3397f533916847))
* do not reuse the Engine.IO id ([2875d2c](https://github.com/socketio/socket.io/commit/2875d2cfdfa463e64cb520099749f543bbc4eb15))
* remove Server#set() method ([029f478](https://github.com/socketio/socket.io/commit/029f478992f59b1eb5226453db46363a570eea46))
* remove Socket#rooms object ([1507b41](https://github.com/socketio/socket.io/commit/1507b416d584381554d1ed23c9aaf3b650540071))
* remove the 'origins' option ([a8c0600](https://github.com/socketio/socket.io/commit/a8c06006098b512ba1b8b8df82777349db486f41))
* remove the implicit connection to the default namespace ([3289f7e](https://github.com/socketio/socket.io/commit/3289f7ec376e9ec88c2f90e2735c8ca8d01c0e97))
* throw upon reserved event names ([4bd5b23](https://github.com/socketio/socket.io/commit/4bd5b2339a66a5a675e20f689fff2e70ff12d236))


### BREAKING CHANGES

* the 'origins' option is removed

Before:

```js
new Server(3000, {
origins: ["https://example.com"]
});
```

The 'origins' option was used in the allowRequest method, in order to
determine whether the request should pass or not. And the Engine.IO
server would implicitly add the necessary Access-Control-Allow-xxx
headers.

After:

```js
new Server(3000, {
cors: {
origin: "https://example.com",
methods: ["GET", "POST"],
allowedHeaders: ["content-type"]
}
});
```

The already existing 'allowRequest' option can be used for validation:

```js
new Server(3000, {
allowRequest: (req, callback) => {
callback(null, req.headers.referer.startsWith("https://example.com"));
}
});
```

* Socket#rooms is now a Set instead of an object

* Namespace#connected is now a Map instead of an object

* there is no more implicit connection to the default namespace:

```js
// client-side
const socket = io("/admin");

// server-side
io.on("connect", socket => {
// not triggered anymore
})

io.use((socket, next) => {
// not triggered anymore
});

io.of("/admin").use((socket, next) => {
// triggered
});
```

* the Server#set() method was removed

This method was kept for backward-compatibility with pre-1.0 versions.

19 changes: 17 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ io.on('connection', socket => {

#### Cross-browser

Browser support is tested in Saucelabs:
Browser support is tested in Sauce Labs:

[![Sauce Test Status](https://saucelabs.com/browser-matrix/socket.svg)](https://saucelabs.com/u/socket)

@@ -138,9 +138,24 @@ io.on('connection', () => { /* … */ });
server.listen(3000);
```

### In conjunction with Fastify

To integrate Socket.io in your Fastify application you just need to
register `fastify-socket.io` plugin. It will create a `decorator`
called `io`.

```js
const app = require('fastify')();
app.register(require('fastify-socket.io'));
app.io.on('connection', () => { /**/ });
app.listen(3000);
```

## Documentation

Please see the documentation [here](/docs/README.md). Contributions are welcome!
Please see the documentation [here](https://socket.io/docs/).

The source code of the website can be found [here](https://github.com/socketio/socket.io-website). Contributions are welcome!

## Debug / logging

Loading