Can API Gateway be used as Websocket client?

0

Hello,

Is it possible to initiate a WebSocket connection from AWS Gateway, or otherwise set up a Serverless/lambda-based connection to an AWS-external Websocket interface? And if so, how?

Any API Gateway/Websocket question/article/tutorial/example I've come across is about hosting a WebSocket API and having clients connect to it, and not the other way around.

The only related question Ive seen is this one but it has not been answered yet: https://stackoverflow.com/questions/69173955/can-i-connect-to-websocket-api-as-a-client-from-aws-api-gateway

Any pointers or help would be much appreciated

1 回答
0
已接受的回答

No, API Gateway only supports incoming web sockets (and also REST) connections. If you want to initiate a connection to some other service, you will need to write code, using some web sockets library, that runs in a container, to establish the connection. You can't use a Lambda function to run this code, unless you expect the connection to be short lived (up to 15 minutes).

profile pictureAWS
专家
Uri
已回答 2 年前
profile picture
专家
已审核 4 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则