You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request
Current behavior
@SubscribeMessage return statement does a new client.emit() instead of sending a response(acknowledgement):
@SubscribeMessage('someMessage')
onSomeMessage(client, data: any) {
return {event: 'someResponse', data: 'Im a separate message' };
}
In contrast something like @Get() returns the response:
findAll(@Param('id') id) {
return `Returning cat with id ${id}...`;
}
Expected behavior
Wouldn't it make sense (logically + for consistency) to have the return statement actually return a response (acknowledgement) to the received message?
@SubscribeMessage('someMessage')
onSomeMessage(client, data: any) {
return 'Response to someMessage';
}
And for sending separate messages explicitly emit a new message?
@SubscribeMessage('someMessage')
onSomeMessage(client, data: any) {
client.emit(event: 'otherMessage', 'Send a different message'); // Or somehow different it this way we cant use interceptors
}
The text was updated successfully, but these errors were encountered:
It is something that applies solely to socket.io. Since we need to support different platforms as well, we have to provide a more generic solution. However, this sounds reasonable:
When returned value is nil, don't emit anything.
When returned value is an object with event property, emit an event.
When returned value is an object without event property, send response (acknowledgement)
I'm submitting a...
Current behavior
@SubscribeMessage
return statement does a newclient.emit()
instead of sending a response(acknowledgement):In contrast something like
@Get()
returns the response:Expected behavior
Wouldn't it make sense (logically + for consistency) to have the return statement actually return a response (acknowledgement) to the received message?
And for sending separate messages explicitly emit a new message?
The text was updated successfully, but these errors were encountered: