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: 4.3.2
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: 4.4.0
Choose a head ref
  • 8 commits
  • 21 files changed
  • 2 contributors

Commits on Nov 8, 2021

  1. feat: add type information to socket.data (#4159)

    Usage:
    
    ```js
    interface SocketData {
      name: string;
      age: number;
    }
    
    const io = new Server<ClientToServerEvents, ServerToClientEvents, InterServerEvents, SocketData>();
    
    io.on("connection", (socket) => {
      socket.data.name = "john";
      socket.data.age = 42;
    });
    ```
    backmeupplz authored Nov 8, 2021
    Configuration menu
    Copy the full SHA
    fe8730c View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2021

  1. feat: add an implementation based on uWebSockets.js

    Usage:
    
    ```js
    const { App } = require("uWebSockets.js");
    const { Server } = require("socket.io");
    
    const app = new App();
    const server = new Server();
    
    server.attachApp(app);
    
    app.listen(3000);
    ```
    
    The Adapter prototype is updated so we can benefit from the publish
    functionality of uWebSockets.js, so this will apply to all adapters
    extending the default adapter.
    
    Reference: https://github.com/uNetworking/uWebSockets.js
    
    Related:
    
    - #3601
    - socketio/engine.io#578
    darrachequesne committed Nov 12, 2021
    Configuration menu
    Copy the full SHA
    c0d8c5a View commit details
    Browse the repository at this point in the history
  2. fix: only set 'connected' to true after middleware execution

    The Socket instance is only considered connected when the "connection"
    event is emitted, and not during the middleware(s) execution.
    
    ```js
    io.use((socket, next) => {
      console.log(socket.connected); // prints "false"
      next();
    });
    
    io.on("connection", (socket) => {
      console.log(socket.connected); // prints "true"
    });
    ```
    
    Related: #4129
    darrachequesne committed Nov 12, 2021
    Configuration menu
    Copy the full SHA
    02b0f73 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2021

  1. Configuration menu
    Copy the full SHA
    2da8210 View commit details
    Browse the repository at this point in the history
  2. test: fix flaky test

    `srv.close()` only closes the underlying HTTP server, but this does not
    terminate the existing WebSocket connections.
    
    Reference: https://nodejs.org/api/http.html#serverclosecallback
    darrachequesne committed Nov 16, 2021
    Configuration menu
    Copy the full SHA
    b7213e7 View commit details
    Browse the repository at this point in the history
  3. feat: add timeout feature

    Usage:
    
    ```js
    socket.timeout(5000).emit("my-event", (err) => {
      if (err) {
        // the client did not acknowledge the event in the given delay
      }
    });
    ```
    darrachequesne committed Nov 16, 2021
    Configuration menu
    Copy the full SHA
    f0ed42f View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2021

  1. fix: prevent double ack when emitting with a timeout

    The ack was not properly removed upon timeout, and could be called
    twice.
    
    Related: f0ed42f
    darrachequesne committed Nov 18, 2021
    Configuration menu
    Copy the full SHA
    b839a3b View commit details
    Browse the repository at this point in the history
  2. chore(release): 4.4.0

    darrachequesne committed Nov 18, 2021
    Configuration menu
    Copy the full SHA
    0f11c47 View commit details
    Browse the repository at this point in the history
Loading