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
demandé il y a 4 ans357 vues
1 réponse
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
répondu il y a 4 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions