0

I am trying to get Client IP which are connecting to the Nodejs websocket server. This blog is what i am follwoing to do so http://blog.seafuj.com/using-elb-with-websockets .This is working and am getting the client IP.

Now my question is this: Once the initial handshake and connection is made from client to server via ELB and ngnix; will the subsequent requests[sendText()] from client go via ELB Or will they go directly to the websoket server bypassing the ELB.

Sample Client code:

var connection = ws.connect('ws://<ELB>:80');
    connection.on("connect", function () {
                console.log("Connection established");
                connection.sendText("Hi");
                connection.sendText("Hello");           
        })

Over here in comments i read that

2) From this moment on and for the lifetime of this TCP connection, the ELB maintains a quasi-direct connection between client and backend server. 3) "quasi-direct" means that the connection is proxied through the ELB. So while the TCP connection is alive, the ELB is fully aware of the two end points taking part (client and backend server). – Jan-Philip Gehrcke

How ever it is not clear to me whether the tcp requests [not the handshake and connection establishment ] go directly to the server OR via ELB->ngnix -> websoket server.

Community
  • 1
  • 1
kamal
  • 15
  • 6

1 Answers1

0

Enabling proxy protocol in ELB will add information such as source ips, destination ips etc in headers apart from that it will not do anything else. All the request to server will go through elb only. if you want to verify it boot the server in private subnet with private ip with elb on top of it ,still it will work.

Madhan S
  • 877
  • 6
  • 11
  • If the requests were http your answer is a sure shot yes. How ever since ws is connection oriented i wonder once the initial handshake is done..does ELB even come in picture for subsequent .sendText(). – kamal Apr 19 '17 at 09:53
  • Yes ws is connection oriented but it is also implemented on top of tcp right, if you still not convinced try out this,reduce the idle timeout in ELB to a 5 secs( default 60 sec) and dont send any data to the connection for 5 secs,ELB will terminate your connection. – Madhan S Apr 20 '17 at 09:17