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: 225ade062a13030164f89356b0a41f28203c3458
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: 8ecfcba5c14cff079c59ccc32e6e5150b17b4a56
Choose a head ref

Commits on Mar 1, 2021

  1. feat: allow to exclude specific rooms when broadcasting (#3789)

    New syntax:
    
    ```
    io.except("room1").emit(...);
    io.to("room1").except("room2").emit(...);
    
    socket.broadcast.except("room1").emit(...);
    socket.to("room1").except("room2").emit(...);
    ```
    
    Related:
    
    - #3629
    - #3657
    sebamarynissen authored and darrachequesne committed Mar 1, 2021
    Copy the full SHA
    7de2e87 View commit details
  2. fix: make io.to(...) immutable

    Previously, broadcasting to a given room (by calling `io.to()`) would
    mutate the io instance, which could lead to surprising behaviors, like:
    
    ```js
    io.to("room1");
    io.to("room2").emit(...); // also sent to room1
    
    // or with async/await
    io.to("room3").emit("details", await fetchDetails()); // random behavior: maybe in room3, maybe to all clients
    ```
    
    Calling `io.to()` (or any other broadcast modifier) will now return an
    immutable instance.
    
    Related:
    
    - #3431
    - #3444
    darrachequesne committed Mar 1, 2021
    Copy the full SHA
    ac9e8ca View commit details
  3. feat: allow to pass an array to io.to(...)

    In some cases it is necessary to pass an array of rooms instead of a single room.
    
    New syntax:
    
    ```
    io.to(["room1", "room2"]).except(["room3"]).emit(...);
    
    socket.to(["room1", "room2"]).except(["room3"]).emit(...);
    ```
    
    Related: #3048
    darrachequesne committed Mar 1, 2021
    Copy the full SHA
    085d1de View commit details

Commits on Mar 2, 2021

  1. feat: add some utility methods

    This commit adds the following methods:
    
    - fetchSockets: returns the matching socket instances
    
    Syntax:
    
    ```js
    // return all Socket instances
    const sockets = await io.fetchSockets();
    
    // return all Socket instances of the "admin" namespace in the "room1" room
    const sockets = await io.of("/admin").in("room1").fetchSockets();
    ```
    
    - socketsJoin: makes the matching socket instances join the specified rooms
    
    Syntax:
    
    ```js
    // make all Socket instances join the "room1" room
    io.socketsJoin("room1");
    
    // make all Socket instances of the "admin" namespace in the "room1" room join the "room2" room
    io.of("/admin").in("room1").socketsJoin("room2");
    ```
    
    - socketsLeave: makes the matching socket instances leave the specified rooms
    
    Syntax:
    
    ```js
    // make all Socket instances leave the "room1" room
    io.socketsLeave("room1");
    
    // make all Socket instances of the "admin" namespace in the "room1" room leave the "room2" room
    io.of("/admin").in("room1").socketsLeave("room2");
    ```
    
    - disconnectSockets: makes the matching socket instances disconnect
    
    Syntax:
    
    ```js
    // make all Socket instances disconnect
    io.disconnectSockets();
    
    // make all Socket instances of the "admin" namespace in the "room1" room disconnect
    io.of("/admin").in("room1").disconnectSockets();
    ```
    
    Those methods share the same semantics as broadcasting. They will also
    work with multiple Socket.IO servers when using the Redis adapter. In
    that case, the fetchSockets() method will return a list of RemoteSocket
    instances, which expose a subset of the methods and attributes of the
    Socket class (the "request" attribute cannot be mocked, for example).
    
    Related:
    
    - #3042
    - #3418
    - #3570
    - socketio/socket.io-redis-adapter#283
    darrachequesne committed Mar 2, 2021
    Copy the full SHA
    b25495c View commit details

Commits on Mar 9, 2021

  1. feat: add support for typed events (#3822)

    Syntax:
    
    ```ts
    interface ClientToServerEvents {
      "my-event": (a: number, b: string, c: number[]) => void;
    }
    
    interface ServerToClientEvents {
      hello: (message: string) => void;
    }
    
    const io = new Server<ClientToServerEvents, ServerToClientEvents>(httpServer);
    
    io.emit("hello", "world");
    
    io.on("connection", (socket) => {
      socket.on("my-event", (a, b, c) => {
        // ...
      });
    
      socket.emit("hello", "again");
    });
    ```
    
    The events are not typed by default (inferred as any), so this change
    is backward compatible.
    
    Note: we could also have reused the method here ([1]) to add types to
    the EventEmitter, instead of creating a StrictEventEmitter class.
    
    Related: #3742
    
    [1]: https://github.com/binier/tiny-typed-emitter
    MaximeKjaer authored and darrachequesne committed Mar 9, 2021
    Copy the full SHA
    0107510 View commit details

Commits on Mar 10, 2021

  1. Copy the full SHA
    1b6d6de View commit details
  2. chore(release): 4.0.0

    darrachequesne committed Mar 10, 2021
    Copy the full SHA
    5eaeffc View commit details

Commits on Mar 18, 2021

  1. fix(typings): update return type from emit (#3843)

    ```
    (channel ? io.to(channel) : io).emit("stuff", message);
    ```
    
    would no longer compile.
    
    Related: #3844
    solomon23 authored and darrachequesne committed Mar 18, 2021
    Copy the full SHA
    1a72ae4 View commit details
  2. Copy the full SHA
    64be1c9 View commit details
  3. Copy the full SHA
    b4ae8d2 View commit details

Commits on Mar 24, 2021

  1. docs(examples): remove unnecessary type annotations (#3855)

    Typed events in Socket.IO 4.0 remove the need for writing type
    annotations in callbacks of reserved events.
    MaximeKjaer authored Mar 24, 2021
    Copy the full SHA
    259f297 View commit details

Commits on Mar 31, 2021

  1. Copy the full SHA
    a11152f View commit details
  2. chore(release): 4.0.1

    darrachequesne committed Mar 31, 2021
    Copy the full SHA
    1faa7e3 View commit details

Commits on Apr 22, 2021

  1. Copy the full SHA
    3665aad View commit details

Commits on May 6, 2021

  1. fix: properly export the Socket class

    Before this change, `require("socket.io").Socket` would return
    "undefined".
    
    Note: having access to the Socket class allows users to modify its
    prototype.
    
    Related: #3726
    darrachequesne committed May 6, 2021
    Copy the full SHA
    d65b6ee View commit details
  2. Copy the full SHA
    b81ce4c View commit details
  3. chore(release): 4.0.2

    darrachequesne committed May 6, 2021
    Copy the full SHA
    9fff034 View commit details

Commits on May 10, 2021

  1. perf: add support for the "wsPreEncoded" writing option

    Packets that are sent to multiple clients will now be pre-encoded for
    the WebSocket transport (which means simply prepending "4" - which is
    the "message" packet type in Engine.IO).
    
    Note: buffers are not pre-encoded, since they are sent without
    modification over the WebSocket connection
    
    See also: socketio/engine.io@7706b12
    
    engine.io diff: socketio/engine.io@5.0.0...5.1.0
    darrachequesne committed May 10, 2021
    Copy the full SHA
    dc381b7 View commit details
  2. feat: add support for inter-server communication

    Syntax:
    
    ```js
    // server A
    io.serverSideEmit("hello", "world");
    
    // server B
    io.on("hello", (arg) => {
      console.log(arg); // prints "world"
    });
    ```
    
    With acknowledgements:
    
    ```js
    // server A
    io.serverSideEmit("hello", "world", (err, responses) => {
      console.log(responses); // prints ["hi"]
    });
    
    // server B
    io.on("hello", (arg, callback) => {
      callback("hi");
    });
    ```
    
    This feature replaces the customHook/customRequest API from the Redis
    adapter: socketio/socket.io-redis-adapter#370
    darrachequesne committed May 10, 2021
    Copy the full SHA
    93cce05 View commit details
  3. feat: notify upon namespace creation

    A "new_namespace" event will be emitted when a new namespace is created:
    
    ```js
    io.on("new_namespace", (namespace) => {
      // ...
    });
    ```
    
    This could be used for example for registering the same middleware for
    each namespace.
    
    See #3851
    darrachequesne committed May 10, 2021
    Copy the full SHA
    499c892 View commit details
  4. Copy the full SHA
    95d9e4a View commit details

Commits on May 11, 2021

  1. chore(release): 4.1.0

    darrachequesne committed May 11, 2021
    Copy the full SHA
    fb6b0ef View commit details
  2. 3
    Copy the full SHA
    b84ed1e View commit details
  3. Copy the full SHA
    891b187 View commit details
  4. chore(release): 4.1.1

    darrachequesne committed May 11, 2021
    Copy the full SHA
    995f38f View commit details

Commits on May 17, 2021

  1. fix: ensure compatibility with previous versions of the adapter

    Using `socket.io@4.1.0` with `socket.io-adapter@2.2.0` would lead to
    the following error:
    
    > Uncaught Error: unknown packet type NaN
    
    Because the packet would be encoded twice, resulting in "undefined".
    
    See also:
    
    - socketio/socket.io-adapter@5579d40
    - dc381b7
    
    Related:
    
    - #3922
    - #3927
    darrachequesne committed May 17, 2021
    Copy the full SHA
    a2cf248 View commit details
  2. Copy the full SHA
    0cb6ac9 View commit details
  3. chore(release): 4.1.2

    darrachequesne committed May 17, 2021
    Copy the full SHA
    1633150 View commit details

Commits on Jun 15, 2021

  1. Copy the full SHA
    6f2a50b View commit details

Commits on Jun 24, 2021

  1. ci: update setup-node step (#3986)

    Daniele TDC authored Jun 24, 2021
    Copy the full SHA
    24d8d1f View commit details

Commits on Jun 28, 2021

  1. ci: update to node 16 (#3990)

    Daniele TDC authored and darrachequesne committed Jun 28, 2021
    Copy the full SHA
    b833f91 View commit details

Commits on Jul 3, 2021

  1. Copy the full SHA
    7c44893 View commit details
  2. fix: remove x-sourcemap header

    This header is useless, as the client bundle already contains a
    sourceMappingURL field.
    
    Besides, Firefox prints the following warning:
    
    > <url> is being assigned a //# sourceMappingURL, but already has one
    
    Related: #3958
    darrachequesne committed Jul 3, 2021
    Copy the full SHA
    a4dffc6 View commit details

Commits on Jul 10, 2021

  1. fix: fix io.except() method

    Previously, calling `io.except("theroom").emit(...)` did not exclude
    the sockets in the given room.
    
    This method was forgotten in [1].
    
    [1]: ac9e8ca
    darrachequesne committed Jul 10, 2021
    Copy the full SHA
    94e27cd View commit details
  2. chore(release): 4.1.3

    darrachequesne committed Jul 10, 2021
    Copy the full SHA
    dbd2a07 View commit details

Commits on Jul 15, 2021

  1. docs(examples): add missing module (#4018)

    Fixes the following error:
    
    > test/todo-management/todo.tests.ts:275:3 - error TS2582: Cannot find name 'describe'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.
    
    Co-authored-by: brownman <brownman@users.noreply.github.com>
    brownman and brownman authored Jul 15, 2021
    Copy the full SHA
    310f855 View commit details

Commits on Aug 30, 2021

  1. Copy the full SHA
    24fee27 View commit details
  2. fix(typings): allow async listener in typed events

    So that:
    
    ```ts
    socket.on("my-event", async () => {
      // ...
    });
    ```
    
    is valid under the @typescript-eslint/no-misused-promises rule.
    
    Related: socketio/socket.io-client#1486
    darrachequesne committed Aug 30, 2021
    Copy the full SHA
    ccfd8ca View commit details
  3. docs: update the link of the Repl.it badge

    The link will now point towards a sample project, instead of the root
    repository.
    
    Related: #3934
    darrachequesne committed Aug 30, 2021
    Copy the full SHA
    d8cc8ae View commit details
  4. Copy the full SHA
    f03eeca View commit details
  5. chore(release): 4.2.0

    darrachequesne committed Aug 30, 2021
    Copy the full SHA
    c100b7b View commit details

Commits on Sep 9, 2021

  1. fix: send volatile packets with binary attachments

    The binary attachments of volatile packets were discarded (only the
    header packet was sent) due to a bug introduced by [1].
    
    Related: #3919
    
    [1]: dc381b7
    darrachequesne committed Sep 9, 2021
    Copy the full SHA
    dc81fcf View commit details
  2. test: remove hardcoded ports

    Related: #3447
    darrachequesne committed Sep 9, 2021
    Copy the full SHA
    7a74b66 View commit details

Commits on Sep 20, 2021

  1. Copy the full SHA
    033c5d3 View commit details

Commits on Oct 8, 2021

  1. Copy the full SHA
    4974e90 View commit details

Commits on Oct 11, 2021

  1. Copy the full SHA
    eb5fdbd View commit details

Commits on Oct 13, 2021

  1. 2
    Copy the full SHA
    60edecb View commit details

Commits on Oct 14, 2021

  1. chore(release): 4.3.0

    darrachequesne committed Oct 14, 2021
    Copy the full SHA
    95810aa View commit details

Commits on Oct 16, 2021

  1. fix: fix server attachment (#4127)

    The check excluded an HTTPS server from being properly attached.
    
    Related: #4124
    HexaField authored Oct 16, 2021
    Copy the full SHA
    0ef2a4d View commit details
  2. chore(release): 4.3.1

    darrachequesne committed Oct 16, 2021
    Copy the full SHA
    ccc5ec3 View commit details
Showing with 16,783 additions and 35,943 deletions.
  1. +1 −1 .github/ISSUE_TEMPLATE/bug_report.md
  2. +2 −2 .github/workflows/ci.yml
  3. +192 −0 CHANGELOG.md
  4. +10 −4 Readme.md
  5. +7 −0 client-dist/socket.io.esm.min.js
  6. +1 −0 client-dist/socket.io.esm.min.js.map
  7. +3,784 −5,214 client-dist/socket.io.js
  8. +1 −1 client-dist/socket.io.js.map
  9. +4 −4 client-dist/socket.io.min.js
  10. +1 −1 client-dist/socket.io.min.js.map
  11. +4 −4 client-dist/socket.io.msgpack.min.js
  12. +1 −1 client-dist/socket.io.msgpack.min.js.map
  13. +1 −0 examples/.gitignore
  14. +0 −13,694 examples/angular-todomvc/package-lock.json
  15. +2 −2 examples/angular-todomvc/package.json
  16. +2 −2 examples/angular-todomvc/server.ts
  17. +26 −0 examples/basic-crud-application/README.md
  18. +17 −0 examples/basic-crud-application/angular-client/.browserslistrc
  19. +16 −0 examples/basic-crud-application/angular-client/.editorconfig
  20. +46 −0 examples/basic-crud-application/angular-client/.gitignore
  21. +31 −0 examples/basic-crud-application/angular-client/README.md
  22. +128 −0 examples/basic-crud-application/angular-client/angular.json
  23. BIN examples/basic-crud-application/angular-client/assets/demo.gif
  24. +37 −0 examples/basic-crud-application/angular-client/e2e/protractor.conf.js
  25. +23 −0 examples/basic-crud-application/angular-client/e2e/src/app.e2e-spec.ts
  26. +11 −0 examples/basic-crud-application/angular-client/e2e/src/app.po.ts
  27. +13 −0 examples/basic-crud-application/angular-client/e2e/tsconfig.json
  28. +44 −0 examples/basic-crud-application/angular-client/karma.conf.js
  29. +46 −0 examples/basic-crud-application/angular-client/package.json
  30. 0 examples/basic-crud-application/angular-client/src/app/app.component.css
  31. +23 −0 examples/basic-crud-application/angular-client/src/app/app.component.html
  32. +31 −0 examples/basic-crud-application/angular-client/src/app/app.component.spec.ts
  33. +59 −0 examples/basic-crud-application/angular-client/src/app/app.component.ts
  34. +19 −0 examples/basic-crud-application/angular-client/src/app/app.module.ts
  35. +140 −0 examples/basic-crud-application/angular-client/src/app/store.ts
  36. 0 examples/basic-crud-application/angular-client/src/assets/.gitkeep
  37. +4 −0 examples/basic-crud-application/angular-client/src/environments/environment.prod.ts
  38. +17 −0 examples/basic-crud-application/angular-client/src/environments/environment.ts
  39. BIN examples/basic-crud-application/angular-client/src/favicon.ico
  40. +13 −0 examples/basic-crud-application/angular-client/src/index.html
  41. +12 −0 examples/basic-crud-application/angular-client/src/main.ts
  42. +63 −0 examples/basic-crud-application/angular-client/src/polyfills.ts
  43. +381 −0 examples/basic-crud-application/angular-client/src/styles.css
  44. +25 −0 examples/basic-crud-application/angular-client/src/test.ts
  45. +15 −0 examples/basic-crud-application/angular-client/tsconfig.app.json
  46. +29 −0 examples/basic-crud-application/angular-client/tsconfig.json
  47. +18 −0 examples/basic-crud-application/angular-client/tsconfig.spec.json
  48. +152 −0 examples/basic-crud-application/angular-client/tslint.json
  49. +16 −0 examples/basic-crud-application/server-postgres-cluster/README.md
  50. +9 −0 examples/basic-crud-application/server-postgres-cluster/docker-compose.yml
  51. +26 −0 examples/basic-crud-application/server-postgres-cluster/lib/app.js
  52. +28 −0 examples/basic-crud-application/server-postgres-cluster/lib/cluster.js
  53. +51 −0 examples/basic-crud-application/server-postgres-cluster/lib/index.js
  54. +140 −0 examples/basic-crud-application/server-postgres-cluster/lib/todo-management/todo.handlers.js
  55. +74 −0 examples/basic-crud-application/server-postgres-cluster/lib/todo-management/todo.repository.js
  56. +22 −0 examples/basic-crud-application/server-postgres-cluster/lib/util.js
  57. +30 −0 examples/basic-crud-application/server-postgres-cluster/package.json
  58. +35 −0 examples/basic-crud-application/server/lib/app.ts
  59. +37 −0 examples/basic-crud-application/server/lib/events.ts
  60. +19 −0 examples/basic-crud-application/server/lib/index.ts
  61. +159 −0 examples/basic-crud-application/server/lib/todo-management/todo.handlers.ts
  62. +49 −0 examples/basic-crud-application/server/lib/todo-management/todo.repository.ts
  63. +24 −0 examples/basic-crud-application/server/lib/util.ts
  64. +37 −0 examples/basic-crud-application/server/package.json
  65. +309 −0 examples/basic-crud-application/server/test/todo-management/todo.tests.ts
  66. +11 −0 examples/basic-crud-application/server/tsconfig.json
  67. +1 −1 examples/chat/README.md
  68. +0 −499 examples/chat/package-lock.json
  69. +1 −1 examples/chat/package.json
  70. +3 −3 examples/chat/public/main.js
  71. +1 −1 examples/cluster-haproxy/server/package.json
  72. +1 −1 examples/cluster-httpd/server/package.json
  73. +1 −1 examples/cluster-nginx/client/package.json
  74. +3 −1 examples/cluster-nginx/docker-compose.yml
  75. 0 examples/cluster-nginx/{nginx → }/nginx.conf
  76. +0 −3 examples/cluster-nginx/nginx/Dockerfile
  77. +21 −18 examples/cluster-nginx/server/index.js
  78. +3 −2 examples/cluster-nginx/server/package.json
  79. +1 −1 examples/cluster-traefik/server/package.json
  80. +2 −2 examples/create-react-app-example/package.json
  81. +5 −1 examples/create-react-app-example/server.js
  82. +14 −1 examples/create-react-app-example/src/App.js
  83. +2,010 −1,807 examples/create-react-app-example/yarn.lock
  84. +4 −4 examples/custom-parsers/package.json
  85. +1 −0 examples/custom-parsers/public/.gitignore
  86. +3 −3 examples/custom-parsers/src/custom-parser.js
  87. +11 −4 examples/custom-parsers/src/server.js
  88. +0 −217 examples/es-modules/package-lock.json
  89. +2 −2 examples/es-modules/package.json
  90. +16 −0 examples/express-session-example/README.md
  91. BIN examples/express-session-example/assets/demo.gif
  92. +57 −0 examples/express-session-example/index.html
  93. +91 −0 examples/express-session-example/index.js
  94. +15 −0 examples/express-session-example/package.json
  95. +2 −2 examples/passport-example/index.js
  96. +0 −783 examples/passport-example/package-lock.json
  97. +1 −1 examples/passport-example/package.json
  98. +1 −1 examples/private-messaging/package.json
  99. +1 −1 examples/private-messaging/server/package.json
  100. +0 −6,654 examples/react-native/package-lock.json
  101. +2 −2 examples/react-native/package.json
  102. +1 −0 examples/rollup-server-bundle/.gitignore
  103. +3 −0 examples/rollup-server-bundle/index.js
  104. +19 −0 examples/rollup-server-bundle/package.json
  105. +12 −0 examples/rollup-server-bundle/rollup.config.js
  106. +5 −1 examples/tweet-stream/index.js
  107. +0 −705 examples/tweet-stream/package-lock.json
  108. +1 −1 examples/tweet-stream/package.json
  109. +0 −295 examples/typescript/package-lock.json
  110. +2 −2 examples/typescript/package.json
  111. +2 −2 examples/typescript/server.ts
  112. +20 −0 examples/webpack-build-server/index.js
  113. +0 −16 examples/webpack-build-server/lib/index.js
  114. +0 −4,137 examples/webpack-build-server/package-lock.json
  115. +6 −4 examples/webpack-build-server/package.json
  116. +0 −9 examples/webpack-build-server/support/webpack.config.js
  117. +19 −0 examples/webpack-build-server/webpack.config.js
  118. +1 −10 examples/webpack-build/README.md
  119. +2 −3 examples/webpack-build/index.html
  120. +15 −0 examples/webpack-build/index.js
  121. +0 −12 examples/webpack-build/lib/index.js
  122. +5 −10 examples/webpack-build/package.json
  123. +0 −2 examples/webpack-build/support/noop.js
  124. +0 −8 examples/webpack-build/support/webpack.config.js
  125. +0 −33 examples/webpack-build/support/webpack.config.json-parser.js
  126. +0 −31 examples/webpack-build/support/webpack.config.slim.js
  127. +7 −0 examples/webpack-build/webpack.config.js
  128. +0 −499 examples/whiteboard/package-lock.json
  129. +1 −1 examples/whiteboard/package.json
  130. +400 −0 lib/broadcast-operator.ts
  131. +93 −47 lib/client.ts
  132. +269 −150 lib/index.ts
  133. +219 −75 lib/namespace.ts
  134. +45 −13 lib/parent-namespace.ts
  135. +291 −79 lib/socket.ts
  136. +180 −0 lib/typed-events.ts
  137. +162 −0 lib/uws.ts
  138. +4,718 −744 package-lock.json
  139. +21 −19 package.json
  140. +1 −1 test/fixtures/server-close.ts
  141. +57 −0 test/socket-timeout.ts
  142. +300 −0 test/socket.io.test-d.ts
  143. +706 −86 test/socket.io.ts
  144. +25 −1 test/support/util.ts
  145. +176 −0 test/utility-methods.ts
  146. +197 −0 test/uws.ts
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
labels: 'to triage'
assignees: ''

---
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -12,12 +12,12 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
node-version: [12, 14, 16]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
192 changes: 192 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,195 @@
# [4.5.0](https://github.com/socketio/socket.io/compare/4.4.1...4.5.0) (2022-04-23)


### Bug Fixes

* **typings:** ensure compatibility with TypeScript 3.x ([#4259](https://github.com/socketio/socket.io/issues/4259)) ([02c87a8](https://github.com/socketio/socket.io/commit/02c87a85614e217b8e7b93753f315790ae9d99f6))


### Features

* add support for catch-all listeners for outgoing packets ([531104d](https://github.com/socketio/socket.io/commit/531104d332690138b7aab84d5583d6204132c8b4))

This is similar to `onAny()`, but for outgoing packets.

Syntax:

```js
socket.onAnyOutgoing((event, ...args) => {
console.log(event);
});
```

* broadcast and expect multiple acks ([8b20457](https://github.com/socketio/socket.io/commit/8b204570a94979bbec307f23ca078f30f5cf07b0))

Syntax:

```js
io.timeout(1000).emit("some-event", (err, responses) => {
// ...
});
```

* add the "maxPayload" field in the handshake details ([088dcb4](https://github.com/socketio/engine.io/commit/088dcb4dff60df39785df13d0a33d3ceaa1dff38))

So that clients in HTTP long-polling can decide how many packets they have to send to stay under the maxHttpBufferSize
value.

This is a backward compatible change which should not mandate a new major revision of the protocol (we stay in v4), as
we only add a field in the JSON-encoded handshake data:

```
0{"sid":"lv_VI97HAXpY6yYWAAAC","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000,"maxPayload":1000000}
```



## [4.4.1](https://github.com/socketio/socket.io/compare/4.4.0...4.4.1) (2022-01-06)


### Bug Fixes

* **types:** make `RemoteSocket.data` type safe ([#4234](https://github.com/socketio/socket.io/issues/4234)) ([770ee59](https://github.com/socketio/socket.io/commit/770ee5949fb47c2556876c622f06c862573657d6))
* **types:** pass `SocketData` type to custom namespaces ([#4233](https://github.com/socketio/socket.io/issues/4233)) ([f2b8de7](https://github.com/socketio/socket.io/commit/f2b8de71919e1b4d3e57f15a459972c1d1064787))



# [4.4.0](https://github.com/socketio/socket.io/compare/4.3.2...4.4.0) (2021-11-18)


### Bug Fixes

* only set 'connected' to true after middleware execution ([02b0f73](https://github.com/socketio/socket.io/commit/02b0f73e2c64b09c72c5fbf7dc5f059557bdbe50))


### Features

* add an implementation based on uWebSockets.js ([c0d8c5a](https://github.com/socketio/socket.io/commit/c0d8c5ab234d0d2bef0d0dec472973cc9662f647))
* add timeout feature ([f0ed42f](https://github.com/socketio/socket.io/commit/f0ed42f18cabef20ad976aeec37077b6bf3837a5))
* add type information to `socket.data` ([#4159](https://github.com/socketio/socket.io/issues/4159)) ([fe8730c](https://github.com/socketio/socket.io/commit/fe8730ca0f15bc92d5de81cf934c89c76d6af329))



## [4.3.2](https://github.com/socketio/socket.io/compare/4.3.1...4.3.2) (2021-11-08)


### Bug Fixes

* fix race condition in dynamic namespaces ([#4137](https://github.com/socketio/socket.io/issues/4137)) ([9d86397](https://github.com/socketio/socket.io/commit/9d86397243bcbb5775a29d96e5ef03e17148a8e7))


## [4.3.1](https://github.com/socketio/socket.io/compare/4.3.0...4.3.1) (2021-10-16)


### Bug Fixes

* fix server attachment ([#4127](https://github.com/socketio/socket.io/issues/4127)) ([0ef2a4d](https://github.com/socketio/socket.io/commit/0ef2a4d02c9350aff163df9cb61aece89c4dac0f))


# [4.3.0](https://github.com/socketio/socket.io/compare/4.2.0...4.3.0) (2021-10-14)


### Bug Fixes

* **typings:** add name field to cookie option ([#4099](https://github.com/socketio/socket.io/issues/4099)) ([033c5d3](https://github.com/socketio/socket.io/commit/033c5d399a2b985afad32c1e4b0c16d764e248cd))
* send volatile packets with binary attachments ([dc81fcf](https://github.com/socketio/socket.io/commit/dc81fcf461cfdbb5b34b1a5a96b84373754047d5))


### Features

* serve ESM bundle ([60edecb](https://github.com/socketio/socket.io/commit/60edecb3bd33801803cdcba0aefbafa381a2abb3))


# [4.2.0](https://github.com/socketio/socket.io/compare/4.1.3...4.2.0) (2021-08-30)


### Bug Fixes

* **typings:** allow async listener in typed events ([ccfd8ca](https://github.com/socketio/socket.io/commit/ccfd8caba6d38b7ba6c5114bd8179346ed07671c))


### Features

* ignore the query string when serving client JavaScript ([#4024](https://github.com/socketio/socket.io/issues/4024)) ([24fee27](https://github.com/socketio/socket.io/commit/24fee27ba36485308f8e995879c10931532c814e))


## [4.1.3](https://github.com/socketio/socket.io/compare/4.1.2...4.1.3) (2021-07-10)


### Bug Fixes

* fix io.except() method ([94e27cd](https://github.com/socketio/socket.io/commit/94e27cd072c8a4eeb9636f6ffbb7a21d382f36b0))
* remove x-sourcemap header ([a4dffc6](https://github.com/socketio/socket.io/commit/a4dffc6527f412d51a786ae5bf2e9080fe1ca63c))


## [4.1.2](https://github.com/socketio/socket.io/compare/4.1.1...4.1.2) (2021-05-17)


### Bug Fixes

* **typings:** ensure compatibility with TypeScript 3.x ([0cb6ac9](https://github.com/socketio/socket.io/commit/0cb6ac95b49a27483b6f1b6402fa54b35f82e36f))
* ensure compatibility with previous versions of the adapter ([a2cf248](https://github.com/socketio/socket.io/commit/a2cf2486c366cb62293101c10520c57f6984a3fc))


## [4.1.1](https://github.com/socketio/socket.io/compare/4.1.0...4.1.1) (2021-05-11)


### Bug Fixes

* **typings:** properly type server-side events ([b84ed1e](https://github.com/socketio/socket.io/commit/b84ed1e41c9053792caf58974c5de9395bfd509f))
* **typings:** properly type the adapter attribute ([891b187](https://github.com/socketio/socket.io/commit/891b1870e92d1ec38910f03bb839817e2d6be65a))


# [4.1.0](https://github.com/socketio/socket.io/compare/4.0.2...4.1.0) (2021-05-11)


### Features

* add support for inter-server communication ([93cce05](https://github.com/socketio/socket.io/commit/93cce05fb3faf91f21fa71212275c776aa161107))
* notify upon namespace creation ([499c892](https://github.com/socketio/socket.io/commit/499c89250d2db1ab7725ab2b74840e188c267c46))
* add a "connection_error" event ([7096e98](https://github.com/socketio/engine.io/commit/7096e98a02295a62c8ea2aa56461d4875887092d), from `engine.io`)
* add the "initial_headers" and "headers" events ([2527543](https://github.com/socketio/engine.io/commit/252754353a0e88eb036ebb3082e9d6a9a5f497db), from `engine.io`)


### Performance Improvements

* add support for the "wsPreEncoded" writing option ([dc381b7](https://github.com/socketio/socket.io/commit/dc381b72c6b2f8172001dedd84116122e4cc95b3))


## [4.0.2](https://github.com/socketio/socket.io/compare/4.0.1...4.0.2) (2021-05-06)


### Bug Fixes

* **typings:** make "engine" attribute public ([b81ce4c](https://github.com/socketio/socket.io/commit/b81ce4c9d0b00666361498e2ba5e0d007d5860b8))
* properly export the Socket class ([d65b6ee](https://github.com/socketio/socket.io/commit/d65b6ee84c8e91deb61c3c1385eb19afa196a909))


## [4.0.1](https://github.com/socketio/socket.io/compare/4.0.0...4.0.1) (2021-03-31)


### Bug Fixes

* **typings:** add fallback to untyped event listener ([#3834](https://github.com/socketio/socket.io/issues/3834)) ([a11152f](https://github.com/socketio/socket.io/commit/a11152f42b281df83409313962f60f230239c79e))
* **typings:** update return type from emit ([#3843](https://github.com/socketio/socket.io/issues/3843)) ([1a72ae4](https://github.com/socketio/socket.io/commit/1a72ae4fe27a14cf60916f991a2c94da91d9e54a))


# [4.0.0](https://github.com/socketio/socket.io/compare/3.1.2...4.0.0) (2021-03-10)


### Bug Fixes

* make io.to(...) immutable ([ac9e8ca](https://github.com/socketio/socket.io/commit/ac9e8ca6c71e00d4af45ee03f590fe56f3951186))


### Features

* add some utility methods ([b25495c](https://github.com/socketio/socket.io/commit/b25495c069031674da08e19aed68922c7c7a0e28))
* add support for typed events ([#3822](https://github.com/socketio/socket.io/issues/3822)) ([0107510](https://github.com/socketio/socket.io/commit/0107510ba8a0f148c78029d8be8919b350feb633))
* allow to exclude specific rooms when broadcasting ([#3789](https://github.com/socketio/socket.io/issues/3789)) ([7de2e87](https://github.com/socketio/socket.io/commit/7de2e87e888d849eb2dfc5e362af4c9e86044701))
* allow to pass an array to io.to(...) ([085d1de](https://github.com/socketio/socket.io/commit/085d1de9df909651de8b313cc6f9f253374b702e))


## [3.1.2](https://github.com/socketio/socket.io/compare/3.1.1...3.1.2) (2021-02-26)


14 changes: 10 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# socket.io
[![Run on Repl.it](https://repl.it/badge/github/socketio/socket.io)](https://repl.it/github/socketio/socket.io)
[![Run on Repl.it](https://repl.it/badge/github/socketio/socket.io)](https://replit.com/@socketio/socketio-minimal-example)
[![Backers on Open Collective](https://opencollective.com/socketio/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/socketio/sponsors/badge.svg)](#sponsors)
[![Build Status](https://github.com/socketio/socket.io/workflows/CI/badge.svg)](https://github.com/socketio/socket.io/actions)
[![Dependency Status](https://david-dm.org/socketio/socket.io.svg)](https://david-dm.org/socketio/socket.io)
[![devDependency Status](https://david-dm.org/socketio/socket.io/dev-status.svg)](https://david-dm.org/socketio/socket.io#info=devDependencies)
[![NPM version](https://badge.fury.io/js/socket.io.svg)](https://www.npmjs.com/package/socket.io)
![Downloads](https://img.shields.io/npm/dm/socket.io.svg?style=flat)
[![](https://slackin-socketio.now.sh/badge.svg)](https://slackin-socketio.now.sh)
@@ -22,7 +20,7 @@ Some implementations in other languages are also available:
- [Swift](https://github.com/socketio/socket.io-client-swift)
- [Dart](https://github.com/rikulo/socket.io-client-dart)
- [Python](https://github.com/miguelgrinberg/python-socketio)
- [.Net](https://github.com/Quobject/SocketIoClientDotNet)
- [.NET](https://github.com/doghappy/socket.io-client-csharp)

Its main features are:

@@ -115,6 +113,14 @@ io.on('connection', client => { ... });
io.listen(3000);
```

### Module syntax

```js
import { Server } from "socket.io";
const io = new Server(server);
io.listen(3000);
```

### In conjunction with Express

Starting with **3.0**, express applications have become request handler
Loading