Which distributed phoenix application will the client connect to?

Hi, I’ve been using elixir for 6 months. There were some stuck points.
I have 2 running phoinex apps. Both are the same app.

for example
the first is pr@127.0.0.1 running on port 4000
second one running on port 4001 is pr2@127.0.0.1

my users use ws://127.0.0.1:4000 port to connect to phoinex socket

my problem is how do i distribute these socket connections between 2 applications

You need to set up a load balancer in front of the apps, it will have a strategy to balance the load and handle users to the correct apps accordingly.

2 Likes