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

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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ