ApiGateway WebSockets - Are the responses sentby integration response route, guaranteed to be in same order than the sent messages?

0

Hi, I try to get a way to verify if my messages were properly handled by ApiGatwayso that i can resend them if a connectiontimeout is triggered. as overriding requestId may not be possible with ApiGateway WebSockets (i posted another question related to that) i thought that relying on order of messages could help. As i already have a ApiGateway response route,sent by service response (i use SQS behin websocket api) i wondered if the order of the responses is guaranteed to be the same thanthe order of sent messages?

If not, what is the recommended way of handling send retries when a connection timeout triggers, or even if an unexpected close event triggers. Thanks Seb

已提問 1 年前檢視次數 312 次
1 個回答
0

If you call the postToConnection API multiple times, there is not guarantee that the messages will get to the client in the same order. If order is important, do not send the second message until you get an ack on the first message.

profile pictureAWS
專家
Uri
已回答 1 年前
  • Thanks, but i was not thinking about postToConnection api, but more the integration reponse from ApiGateway. Maybe it uses same api in background?

  • Sorry, my bad. I thought you were referring to messages send by the backend.

    If you get two messages and send these messages to the integration for processing, and they return a response, which API GW should send back to the client, you have no control in which order the client messages will be processed, so you don't know in which order the responses will arrive back to API Gateway.

    Bottom line, you can't rely on message ordering for the responses.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南