Skip to content

Get all topics with >0 subscribers matching a pattern #555

Answered by gitcatrat
gmencz asked this question in Q&A
Discussion options

You must be logged in to vote

@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);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gmencz
Comment options

Answer selected by gmencz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants