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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠