aws-samples / simple-websockets-chat-app

This SAM application provides the Lambda functions, DynamoDB table, and roles to allow you to build a simple chat application based on API Gateway's new WebSocket-based API feature.
MIT No Attribution
690 stars 280 forks source link

Stale connection not being detected #44

Closed mustafapc19 closed 2 years ago

mustafapc19 commented 3 years ago

There is section of code where the 'stale' connection is detected. This is the code snippet. I am not using the Promise.all that u guys are using if it does affect in anyway. Just calling await normally. And the value of apiRes here is {}, without erroring out Is there any work around to this? Because now sometimes my messages goes into unknown darkness :(

      try {
        var apiRes = await apigwManagementApi.postToConnection({
          ConnectionId: connectionId,
          Data: JSON.stringify(sockBody.data)
        }).promise();
        console.log('apiRes',apiRes);
      } catch (e) {
        console.log('apigwManagementApi.postToConnection:catch:',e);
      }
dgomesbr commented 2 years ago

Hello mustafapc19, API Gateway will do its best effort to detect and emit an event.