setting variables to room spesific or pub/sub spesific #296
-
how to accomplish this in socket.io we can do something like this io.sockets.adapter.clients(["room1"].somevariable="Hello world"
io.sockets.adapter.clients(["room1"].someother="A Message" i can use mongodb or redis but the data is not quite big i don't want to use them all, i just need local storage like solution |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
There are no Adapters in this project. From what I can understand, Adapters are used to link multiple Socket.IO instances together to achieve a chain-reaction across multiple machines. This is not really that hard to achieve without Adapters, it's really just a tree of nodes publishing to each other - like 5 lines code. You can use Redis or MQTT or anything for this, even Socket.IO itself. I typically use Redis pub/sub for this, internally. And many companies do because Redis is a pretty decent project. But for this example you shown here, I can't make out what you're trying to achieve? Why wouldn't you just hold a map from topic name to data? Or did I miss something? |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. This is great library many thanks. |
Beta Was this translation helpful? Give feedback.
There are no Adapters in this project. From what I can understand, Adapters are used to link multiple Socket.IO instances together to achieve a chain-reaction across multiple machines.
This is not really that hard to achieve without Adapters, it's really just a tree of nodes publishing to each other - like 5 lines code. You can use Redis or MQTT or anything for this, even Socket.IO itself.
I typically use Redis pub/sub for this, internally. And many companies do because Redis is a pretty decent project.
But for this example you shown here, I can't make out what you're trying to achieve? Why wouldn't you just hold a map from topic name to data? Or did I miss something?