Expecting exactly one acknowledgment when broadcasting with timeout #5062
-
I was wondering if there is any way to broadcast an event with a timeout and not awaiting all acknowledgments but only the first one (or the first N acks) in order to proceed. I've seen this API io.timeout(1000).emit('event', (errors, acks) => {
// .. proceed
}) but I guess that, in this case, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Hi! No, this is not currently possible, the server waits for all clients before calling the callback method. I guess we could indeed provide a way to iterate over the acks as they come, maybe something like this: try {
for await (const ack of io.timeout(1000).emitWithAck("event")) {
console.log(ack);
}
} catch (e) {
// timeout
} |
Beta Was this translation helpful? Give feedback.
Hi! No, this is not currently possible, the server waits for all clients before calling the callback method.
I guess we could indeed provide a way to iterate over the acks as they come, maybe something like this: