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-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.5.4
Choose a base ref
...
head repository: socketio/socket.io-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.6.0
Choose a head ref
  • 16 commits
  • 21 files changed
  • 2 contributors

Commits on Dec 14, 2022

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

Commits on Jan 16, 2023

  1. fix(typings): properly type emits with timeout (#1570)

    When emitting with a timeout (added in version 4.4.0), the "err"
    argument was not properly typed and would require to split the client
    and server typings. It will now be automatically inferred as an Error
    object.
    
    Workaround for previous versions:
    
    ```ts
    type WithTimeoutAck<isEmitter extends boolean, args extends any[]> = isEmitter extends true ? [Error, ...args] : args;
    
    interface ClientToServerEvents<isEmitter extends boolean = false> {
        withAck: (data: { argName: boolean }, callback: (...args: WithTimeoutAck<isEmitter, [string]>) => void) => void;
    }
    
    interface ServerToClientEvents<isEmitter extends boolean = false> {
    
    }
    
    const io = new Server<ClientToServerEvents, ServerToClientEvents<true>>(3000);
    
    io.on("connection", (socket) => {
        socket.on("withAck", (val, cb) => {
            cb("123");
        });
    });
    
    const socket: Socket<ServerToClientEvents, ClientToServerEvents<true>> = ioc("http://localhost:3000");
    
    socket.timeout(100).emit("withAck", { argName: true }, (err, val) => {
      // ...
    });
    ```
    
    Related: #1555
    engina authored and darrachequesne committed Jan 16, 2023
    Configuration menu
    Copy the full SHA
    33e4172 View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2023

  1. fix(typings): properly type emits with timeout (2)

    This follows [1], in order to keep the label of each argument.
    
    [1]: 33e4172
    
    Related:
    
    - #1570 (comment)
    - microsoft/TypeScript#39941
    - microsoft/TypeScript#48049
    darrachequesne committed Jan 17, 2023
    Configuration menu
    Copy the full SHA
    a1c528b View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2023

  1. feat: implement connection state recovery

    Connection state recovery allows a client to reconnect after a
    temporary disconnection and restore its state:
    
    - id
    - rooms
    - data
    - missed packets
    
    See also: socketio/socket.io@54d5ee0
    darrachequesne committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    b4e20c5 View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2023

  1. feat: add promise-based acknowledgements

    This commit adds some syntactic sugar around acknowledgements:
    
    ```js
    // without timeout
    const response = await socket.emitWithAck("hello", "world");
    
    // with a specific timeout
    try {
      const response = await socket.timeout(1000).emitWithAck("hello", "world");
    } catch (err) {
      // the server did not acknowledge the event in the given delay
    }
    ```
    
    Note: enviroments that do not support Promises ([1]) will need to add a
    polyfill in order to use this feature
    
    See also: socketio/socket.io@184f3cf
    
    [1]: https://caniuse.com/promises
    darrachequesne committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    47b979d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f27cba5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9f32925 View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2023

  1. feat: implement retry mechanism

    Syntax:
    
    ```js
    const socket = io({
      retries: 3,
      ackTimeout: 10000
    });
    
    // "my-event" will be sent up to 4 times (1 + 3), until the server sends an acknowledgement
    socket.emit("my-event", (err) => {});
    ```
    
    Notes:
    
    - the order of the packets is guaranteed, as we send packets one by one
    - the same packet id is reused for consecutive retries, in order to
    allow deduplication on the server side
    darrachequesne committed Feb 1, 2023
    Configuration menu
    Copy the full SHA
    655dce9 View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2023

  1. Configuration menu
    Copy the full SHA
    b7dd891 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b1eed5f View commit details
    Browse the repository at this point in the history
  3. refactor: minor edit

    Following 655dce9
    darrachequesne committed Feb 3, 2023
    Configuration menu
    Copy the full SHA
    5ba0d49 View commit details
    Browse the repository at this point in the history

Commits on Feb 4, 2023

  1. Configuration menu
    Copy the full SHA
    0110e46 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c54e09d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4d6d95e View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2023

  1. chore: bump engine.io-client to version 6.4.0

    The minor bump is due to changes on the server side, but we'll keep the
    versions in sync.
    
    Diff: socketio/engine.io-client@6.3.1...6.4.0
    Release notes: https://github.com/socketio/engine.io-client/releases/tag/6.4.0
    darrachequesne committed Feb 6, 2023
    Configuration menu
    Copy the full SHA
    dff34a3 View commit details
    Browse the repository at this point in the history
  2. chore(release): 4.6.0

    darrachequesne committed Feb 6, 2023
    Configuration menu
    Copy the full SHA
    5980918 View commit details
    Browse the repository at this point in the history
Loading