-
Notifications
You must be signed in to change notification settings - Fork 486
serverSideEmit with ack question #431
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
Comments
If there was an option to override numsub (since I know how many responses I should get) with a param given to serverSideEmit then it would solve this issue |
Well, can't you just... ignore the timeout? Or send an empty reply from the other services? |
I could, but it's kind of weird that the sender needs to reply to its own messages. |
Closed due to inactivity, please reopen if needed. |
I have multiple nodejs services, all of which are connected to the same socket.io-redis-adapter.
I want to be able to send messages between these services with acknowledgement using serverSideEmit.
My problem is the next scenario:
Let's say I have 3 nodejs services - s1, s2, s3.
Both s1 and s2 are sending the same message m1 to a namespace which is also called m1 (for the sake of simplicity):
io.of(/m1).serverSideEmit(m1, data, (error, responses) => {})
I want only s3 to subscribe to m1 namespace.
The problem with the current implementation, is that after s1 sends m1, and s2 sends m1, we now we have 3 subscribers to m1 namespace (s1, s2, s3), but only s3 is set to ack this message:
io.of(/m1).on(m1, (data, callback) => {})
any service that sends m1 (either s1 or s2) is waiting for 2 responses (since it has 3 subscribers), but it only gets 1 response (from s3), and keeps throwing errors due to timeout
How can I work around this issue?
The text was updated successfully, but these errors were encountered: