- Newest
- Most votes
- Most comments
According to the AWS documentation, API Gateway WebSocket APIs use a single TCP connection for each WebSocket connection. This means that if multiple concurrent requests are made to the same WebSocket connection, there is a potential for data race conditions and interleaving of frames, which can cause the client to receive corrupted or invalid frames.
While API Gateway aims to maintain the correct order of messages sent to a WebSocket connection, it cannot guarantee that frames from concurrent requests won't be interleaved, especially if the responses are sent back in a different order than the requests were received.
To address this issue, the recommended approach is to ensure that only one request is processed at a time for a given WebSocket connection. This can be achieved by implementing a synchronization mechanism in your application logic, such as using a lock or a queue.
Relevant content
- asked 8 months ago
- asked 5 years ago
- AWS OFFICIALUpdated 4 months ago