1 Answer
- Newest
- Most votes
- Most comments
1
You can't use API Gateway as a websocket proxy between a client and a backend (the Fargate cluster in your case). The gateway does not support this.
API Gateway does support websockets, but the connection is maintained between the client and the gateway itself. All messages it receives on the connections are forwarded to the backend using regular HTTP requests. Similarly, when the backend wants to send a message to the client, it sends an HTTTP request to the special endpoint in the gateway so that the gateway forwards the message to the client.
Relevant content
- Accepted Answerasked a year ago
- asked 10 months ago
- Accepted Answerasked 7 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 2 months ago
Thanks Uri for the response ,Can u shed some light on what could be the right way to go about this.
If you need a websocket all the way to backend, expose the ALB directly to the client, without an API Gateway.
Hi Uri ,thanks for the response, we have a common private ALB for multiple services within a VPC... we can't change the architecture for a singe service.. can u suggest any other solution
If you need a websocket all the way to your backend, you options are to expose the ALB directly (and it can be a new ALB, just for that service, fronting the same cluster), or use a Global accelerator to access the private ALB.
Thanks. This was helpful for my case. I cannot find the AWS document explaining that how API Gateway connects the client and the backend in different way, thou. They only offered the best practice of the Websocket API Gateway architecture using VPC Link.