0

I need some help in multi-node socket connection.

enter image description here

I want to make a cluster of nodes, where each node will be connected to the other with a web socket.

means all nodes will be both client and server.

is this possible? any code example in python, javascript (I only know thee 2 languages)

1101 tech
  • 45
  • 1
  • 4
  • It is possible for each server to open a connection to all the other servers, but that gets unwieldy if there are very many, and requires lots of bookkeeping. It is usually better to have one server be the "master", and give it the job of distributing messages to an arbitrary number of subscribers. – Tim Roberts Aug 02 '21 at 17:30
  • thanks, I understand the point. – 1101 tech Aug 02 '21 at 17:37
  • You could use **MQTT** and pub/sub so that anyone who's interested in receiving messages on any topic can subscribe to it, and anyone who wants to send messages on any topic (or to any node) can publish on that topic. Or you could use **Redis** and have as many queues of messages as you like and allow any folk who are interested to pop messages off that queue. – Mark Setchell Aug 02 '21 at 19:57
  • Python examples of similar things... https://stackoverflow.com/a/64647027/2836621 – Mark Setchell Aug 02 '21 at 19:59
  • thanks for the answers. I will check all the options – 1101 tech Aug 04 '21 at 11:50

0 Answers0