'AWS Websocket POST problem from server to client (Offset reception)

I send data to front-end client by APIGateway and WebSocket with a Lambda in JS :

const params = {
    ConnectionId: clientId,
    Data: JSON.stringify(message) // message envoyé au client 
};
await client.postToConnection(params).promise()

When I use this code in a Lambda which is used by some routes in APIGateway it works perfectly. When I use an other lambda which is activate by a dynamoDB Stream, the lambda is executed when I insert new data and the post event appears on CloudWatch for the lambda but don't appears on CloudWatch for the APIGateway Socket and of course on the front-end ??? If I insert again new different data in dynamoDB, CloudWatch shows the Post of the first inserted data ??? And again and again there is always an offset in the message reception in the front-end. I can't understand why ???



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source