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 年前檢視次數 362 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南