Skip to content

Bug Report to tracking websit #15792

@itsomg134

Description

@itsomg134

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Current behavior
When emitting a Socket.IO event with a callback from the client (i.e., emit(event, payload, ack)), the third parameter ack is not received in the NestJS gateway method decorated with @SubscribeMessage. Only two arguments are passed: the socket instance and the payload.

Minimum reproduction code
https://github.com/duc190604/bug_report

Steps to reproduce
How to Run and Test the Application
🔧 Start the Server (NestJS):
Open terminal.

Navigate to the server directory.

Run the server with the appropriate command (e.g., npm run start:dev).

The server will be running at:
http://localhost:3001/

💻 Start the Client (React):
Open a new terminal.

Navigate to the client directory.

Run the client with the appropriate command (e.g., npm start).

The client will be running at:
http://localhost:3000/

🌐 Test WebSocket Connection

Open the client in a browser:
Go to: http://localhost:3000/
You should see a UI with:

Connection status (🟢 Connected or 🔴 Disconnected)

An input field for typing messages

A "Send" button

Test message sending:
Type a message (e.g., Hello Server) in the input box
Press Enter or click the Send button

Wait for the server response displayed below the input

🧾 Check Client Logs (Browser Console):
Open DevTools (press F12)

Watch for the following logs:

"Connected to server" when the connection is established

"Sending message: ..." when a message is sent

"Received acknowledgment: ..." when the server responds

🖥️ Check Server Logs (Terminal):
In the terminal running the server, observe:

"Server is running on port 3001" after the server starts

"args: ..." when a message is received from the client ( and don't include ack)

Expected behavior
The ack callback function should be passed to the last parameter of the handler, and be callable from within NestJS so the server can send an acknowledgment to the client.

Package

I don't know. Or some 3rd-party package

@nestjs/common

@nestjs/core

@nestjs/microservices

@nestjs/platform-express

@nestjs/platform-fastify

@nestjs/platform-socket.io

@nestjs/platform-ws

@nestjs/testing

@nestjs/websockets

Other (see below)
Other package
No response

NestJS version
11.1.3

Packages versions
platform-socket.io version : 11.1.3
platform-express version : 11.1.3
websockets version : 11.1.3
schematics version : 11.0.5
mongoose version : 11.0.3
passport version : 11.0.5
swagger version : 11.2.0
testing version : 11.1.1
common version : 11.1.3
config version : 4.0.2
core version : 11.1.3
jwt version : 11.0.0
cli version : 11.0.7

Node.js version
v22.13.0

In which operating systems have you tested?

macOS

Windows

Linux
Other

Minimum reproduction code

https://github.com/itsomg134

Steps to reproduce

  1. Note Js
  2. Padarc Charm
  3. Node.json

Expected behavior

Current behavior
When emitting a Socket.IO event with a callback from the client (i.e., emit(event, payload, ack)), the third parameter ack is not received in the NestJS gateway method decorated with @SubscribeMessage. Only two arguments are passed: the socket instance and the payload.

NestJS version

11.0.0.0

Packages versions

Current behavior
When emitting a Socket.IO event with a callback from the client (i.e., emit(event, payload, ack)), the third parameter ack is not received in the NestJS gateway method decorated with @SubscribeMessage. Only two arguments are passed: the socket instance and the payload.

Node.js version

12.02.

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

Current behavior
When emitting a Socket.IO event with a callback from the client (i.e., emit(event, payload, ack)), the third parameter ack is not received in the NestJS gateway method decorated with @SubscribeMessage. Only two arguments are passed: the socket instance and the payload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue has not been looked into

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions