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 Answer
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
EXPERT
Uri
answered a year ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions