uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.76k stars 563 forks source link

Proper use of topics #943

Closed mkgn closed 1 year ago

mkgn commented 1 year ago

This is with reference to the comment made here. I am coming from a .Net background and in SignalR, they say it's ok to create a so called "group/topic" per connection. Initially I was planning to subscribe every connected socket to a topic with the name of [user.id] (who owns that socket). This way when someone wants to send a message to this user you can just publish to user.id topic. If I go down this path, it'll end up having MANY topics (for single users and groups) which is not the best according to what I gathered.

So, the next option then is to keep a look up table with [user.id][socket] pairs for sending individual messages.

Am I thinking correct here?

uNetworkingAB commented 1 year ago

You can do either way. Those comments no longer apply, we have a completely different pub/sub since v20.