Websockets. Send a response and then immediately disconnect the user

0

I am looking for a better way to implement the following:
The user communicates via the Gateway Websockets API (two-way communication) with the lambda function (lambda-proxy integration) and at a certain point, the lambda should send a full response and immediately disconnect the user.

Thanks

Alex4
已提问 4 年前360 查看次数
1 回答
1

In a naive way, your Lambda can invoke postToConnection then deleteConnection. However, this doesn't guarantee the message would be delivered to the client before disconnecting it.

Ideally, the client should disconnect when the message arrives. If you still want to disconnect the client from the server side, you'll need to implement ACK between the client and the server. If the client needs to send a ACK message after the receiving the response. Then your Lambda can safely disconnect the client.

AWS
已回答 4 年前

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

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

回答问题的准则

相关内容