socket.io-client-java icon indicating copy to clipboard operation
socket.io-client-java copied to clipboard

AWS App Load balancer Cookie-based sticky sessions

Open payanacloud opened this issue 9 years ago • 1 comments

Hi I am trying to get socket.io-client-java v0.9 working with AWS App Load balancer. I have created a target group with multiple EC2 instances and enabled load balancer generated cookie stickiness. The Ec2 instances are using socket.io server v1.7.4 and socket.io.redis. Each instance is running nodejs v4 and is behind nginx. I have added the upgrade headers for nginx conf as well. This setup works when socket.io.client runs on the browser. Handshake is successful and connection is upgraded to websocket. But socket.io-client-java which I am using in my android app, is throwing XHR poll errors when connecting to the server. I see that the load balancer is not connecting to the same instance for the handshake process and http 400 errors are seen. I am guessing the ALB cookie is not being sent in the polling requests from the client. Is there something I am missing? Is there a workaround. The only one I know is to disable polling and to allow only websocket connections from the client. Any help will be appreciated. Thanks

payanacloud avatar Oct 21 '17 09:10 payanacloud

For future readers:

This was added in the documentation: https://socketio.github.io/socket.io-client-java/faq.html#How_to_use_with_AWS_Load_Balancing

Please reopen if needed.

darrachequesne avatar Jul 02 '22 05:07 darrachequesne