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개 답변
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
답변함 일 년 전
  • 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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠