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: 3.0.0-rc2
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-rc3
Choose a head ref
  • 8 commits
  • 21 files changed
  • 1 contributor

Commits on Oct 15, 2020

  1. Configuration menu
    Copy the full SHA
    20ea6bd View commit details
    Browse the repository at this point in the history
  2. 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
    Configuration menu
    Copy the full SHA
    a81b9f3 View commit details
    Browse the repository at this point in the history

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
    Configuration menu
    Copy the full SHA
    7603da7 View commit details
    Browse the repository at this point in the history
  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
    Configuration menu
    Copy the full SHA
    0d74f29 View commit details
    Browse the repository at this point in the history

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
    Configuration menu
    Copy the full SHA
    129c641 View commit details
    Browse the repository at this point in the history

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 Configuration menu
    Copy the full SHA
    5c73733 View commit details
    Browse the repository at this point in the history
  2. refactor: rename ERROR to CONNECT_ERROR

    The meaning is not modified: this packet type is still used by the
    server when the connection to a namespace is refused.
    darrachequesne committed Oct 25, 2020
    Configuration menu
    Copy the full SHA
    d16c035 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2020

  1. Configuration menu
    Copy the full SHA
    cacad70 View commit details
    Browse the repository at this point in the history
Loading