Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Lack support for ACK callbacks #2679

Closed
derevnjuk opened this issue Apr 25, 2024 · 2 comments · Fixed by #2680
Closed

[BUG] Lack support for ACK callbacks #2679

derevnjuk opened this issue Apr 25, 2024 · 2 comments · Fixed by #2680

Comments

@derevnjuk
Copy link
Contributor

derevnjuk commented Apr 25, 2024

Describe the bug

When using @Argsdecorators in the listeners from @tsed/socketio, the ACK callbacks are mistakenly passed to the deserialise function, which leads to a failure. The current implementation tries to deserialize callback functions when they are passed as arguments, which is not the appropriate behavior.

To Reproduce

  1. Create a socket service with an input event that expects a callback function.
  2. Define the callback function as an argument to the event.
  3. Trigger the event and observe that the service attempts to deserialize the callback function, resulting in an error.
// server.ts
@SocketService("/room")
export class TestService {
  @Input("eventName")
  event(@Args(0) callback: () => void) { // throws an error
    callback();
  }
}

// client.ts
const socket = io("/room")
await socket.emitWithAck('eventName') // will never fulfilled 

Expected behavior

The callback function should be passed through without any attempt at deserialization.

Actual behavior

The callback function is incorrectly processed by the deserialization function, which results in a error

Repository URL example

No response

OS

macOs

Node version

Node v20

Library version

v7.67.8

Additional context

No response

Copy link

🎉 Are you happy?

If you appreciated the support, know that it is free and is carried out on personal time ;)

A support, even a little bit makes a difference for me and continues to bring you answers!

github opencollective

@Romakita
Copy link
Collaborator

🎉 This issue has been resolved in version 7.68.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants