'Sending a message from one Websocket connection another existing Websocket connection from another server

I am new to WebSockets and NodeJS and experimenting with realtime chat application using NodeJS and WebSockets. Here I try to understand how I can scale my application to support multiple instances of WebSocket server, so that client A can send a message to client B in case when they are connected to different WebSocket servers.

  1. Can I use messaging queue to solve this problem?
  2. Is there a better way to solve this problem apart from messaging queue, so that client A can somehow send a message directly to client B from one server side connection to another connection on different server. I am thinking about potentially storing connection in some cache and share it between the clients...

Which frameworks to use doesn't really matter as long as it has a great support/popularity.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source