Ack emit is not propagated through onAnyOutgoing

Open
#4,489 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
api, backend

Research direction

Start with the server-side socket event handling shown in the reproduction, then trace how the msg acknowledgment callback is emitted and how onAnyOutgoing observes outgoing messages. Reproduce the server and client example, and confirm that the acknowledgment is included in the outgoing-event observation when the behavior is fixed.

Written by the indexing model from the issue text.

Description

enhancement

Describe the bug
Ack emit is not propagated through onAnyOutgoing.

To Reproduce

Socket.IO server version: latest

Server

import { Server } from "socket.io";

const io = new Server(3000, {});

io.on("connection", (socket) => {
  console.log(`connect ${socket.id}`);

  socket.use((event) => {
    console.log(event) // not logger for "test msg"
  })

  socket.on('msg', (reply) => {
     reply('test msg')
  })

  socket.on("disconnect", () => {
    console.log(`disconnect ${socket.id}`);
  });
});

Socket.IO client version: latest

Client

import { io } from "socket.io-client";

const socket = io("ws://localhost:3000/", {});

socket.on("connect", () => {
  console.log(`connect ${socket.id}`);
});

socket.emit("msg")

socket.on("disconnect", () => {
  console.log("disconnect");
});

Expected behavior
onAnyOutgoing is called for ANY outgoing message

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

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.

More from socketio/socket.io

All issues in socketio/socket.io

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.