Description
I've clustered my socket.io server and I'm looking for a way to emit to a specific client and receiving a acknowledgment callback. The problem that the server doesn't have a reference to a instance of the target client, because this client can be connected to another socket.io server instance (because it's clustered).
I know I can emit to a room named after the the socket.id or a custom room where I put the client in. But the problem is that this is considered broadcasting and then I can't use a acknowledgment callback.
I don't want to add complexity to the target client. The target client should just be able to call the callback.
I see two possible solutions:
- Find a way to create a fake socket instance with the socket.id (so I can use existing callback code)
- Broadcast to a room and build my own callback system, see: Need ability to arbitrarily emit with callback to a socket client. #1656 (comment)
A fake socket instance wouldn't actually have a connection to a client, but I hope to use it's emit function, have it talk to it's adapter (socket.io-redis) and have it receive the acknowledgment callback.
Any tips on these solutions, maybe something I should also consider.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status