Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Websockets with AWS and Elastic Beanstalk

I'm trying to get my websockets working with Amazon Web Service and Elastic Beanstalk (ELB).

I set up a proxy protocol according to: http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/enable-proxy-protocol.html

I've opened up all inbound traffic to my load balancer and other security groups on all ports, for all IPs.

I also kept the load balancer listerner as HTTP on port 80.

My websocket connection gives the following error when trying to connect on port 80: failed: Error during WebSocket handshake: Unexpected response code: 400

And this error on port 8080: failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Would appreciate suggestions, I'm stuck at this point.

Thanks!

like image 232
Martok11 Avatar asked Dec 12 '14 02:12

Martok11


People also ask

Does AWS ELB support WebSocket?

The Classic ELB doesn't support Websockets.

How do WebSockets work with load balancer?

The load balancer knows how to upgrade an HTTP connection to a WebSocket connection and once that happens, messages will travel back and forth through a WebSocket tunnel. However, you must design your system for scale if you plan to load balance multiple WebSocket servers.

Does ALB support WebSockets?

Azure Load balancer does not support WebSockets.


1 Answers

After configuring EC2 Security group your application will work with public IP.

But you still will get issue with using EB URL. To solve this issue, you have to change EB configuration.

  1. Go to EB environment page
  2. Configuration
  3. In Load Balancing section change protocol from HTTP to TCP.

Now you can click EB URL.

like image 85
Oleg Imanilov Avatar answered Sep 27 '22 20:09

Oleg Imanilov