socketio / socketio/socket.io

Add response Ack in socket.prependAnyOutgoing()

Open
#4,649 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

I'm using

  socket.use(([event, ...args], next) => {
    incommingEventFilter(socket, [event, args], next);
  });
  socket.prependAnyOutgoing(outgoingEventFilter);

to filter and log all income & outgoing event;

It work well...but...

Client-Side:

socket.emitWithAck("hello", "world", (err, val) => {
  //...
});

Server-Side:

socket.on("hello", (arg, callback) => {
    console.log(arg); // "world"
    callback("got it");
});

In postman client, i received event 'hello' with data 'got it';

The one thing is event 'hello' with 'got it' was not logged by socket.prependAnyOutgoing()

Describe the solution you'd like
Please add callback Ack to socket.prependAnyOutgoing() or is there any way to log all callback Ack 🤔🤔

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the socket.prependAnyOutgoing() entry point and compare it with the socket.emitWithAck() and server-side socket.on("hello", ...) flow shown in the issue. Trace where the acknowledgement is sent and determine how it could be included in outgoing-event logging. Done means callback acknowledgements are observable through prependAnyOutgoing without breaking existing event handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.