-
The title says it all but I'll give an example use case. Each user in my app subscribes to their own topic ( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@gmencz I can't answer your question but... How many "users" (I assume user === socket) do you have? Topics are relatively expensive, 1 topic per socket is not recommended, a much cheaper alternative is to store them in JS object/set like this: const sockets = {
// some kind of user identifier as a key
'mS3lfSdF': SocketRef
}; And when you need to send a message to single socket, it's as easy as this: sockets[userId].send(message, isBinary, true); |
Beta Was this translation helpful? Give feedback.
@gmencz I can't answer your question but...
How many "users" (I assume user === socket) do you have? Topics are relatively expensive, 1 topic per socket is not recommended, a much cheaper alternative is to store them in JS object/set like this:
And when you need to send a message to single socket, it's as easy as this: