-1

I have been using socket cluster to setup socket servers. Is there anyway to use multiple socket cluster running on same machine on same port?

Ex:

App connects to ws://server.com/app-one Another App connects to ws://server.com/app-two

Vish K
  • 127
  • 1
  • 2
  • 11
  • 1
    I don't understand your question. What does this mean: `multiple socket cluster running on same machine on same port`? And, what does this mean: `Different clients with different purposes, different purposes different server.`? Please edit your question to clarify. – jfriend00 Mar 08 '17 at 18:48
  • You could not have multiple socketclusters (serving different apps) running on the same machine on the same port because there would be no way to direct a given connection to the right cluster. You'd have to have some additional proxy or other network device that would direct an incoming connection to the right cluster based on some characteristic of the initial connection and then those clusters would be running on different ports. – jfriend00 Mar 08 '17 at 18:56
  • Thanks, I was wondering if there is a way to connect to the right cluster based on path or something.. Ex: ws://SSS.com/app1 and as://SSS.com/another-app – Vish K Mar 08 '17 at 21:12
  • Then, you should edit your question to ask EXACTLY that. Your question as it stands now has downvotes because it's not clear at all. It is your responsibility to make it a clear question. – jfriend00 Mar 08 '17 at 21:13
  • Question modified. – Vish K Mar 08 '17 at 21:18

1 Answers1

1

Is there anyway to use multiple socket cluster running on same machine on same port?

No. Not directly. You need some sort of other process to serve as a proxy to separate out the incoming connections on your main port and then forward then to the appropriate cluster (each of which would be running on a different port).

So, a proxy process would be running on your main port whatever that was. Each websocket cluster would be running on its own unique port. An incoming connection would arrive at the proxy and then be forwarded to the right socketcluster. My guess is that you could use NGINX as your proxy and configure it to route to the right cluster based on path.

jfriend00
  • 683,504
  • 96
  • 985
  • 979
  • Thanks, wanted to know if socket cluster can handle it by itself. If not, I will try this. – Vish K Mar 08 '17 at 21:21
  • @VishK - Not that I know of. – jfriend00 Mar 08 '17 at 21:33
  • @VishK - If this answered your question, then you can indicate that to the community by clicking the green checkmark to the left of the answer. That will also earn your some reputation points for following the proper procedure here on stack overflow. – jfriend00 Mar 24 '17 at 04:18