WebSocket API on AWS API Gateway 2h Connection duration

0

Hi.. I have seen there is a 2h Connection duration limit for Websocket APIs. I know there is a related question https://repost.aws/questions/QUFbNpkJJvTySYuHA7uHQAeQ/extend-websocket-idle-connection-timeout

As this is our first API I am wondering if this would be an acceptable attribute. As we run an IoT Platform and via a websocket API we would like to push incoming data to our customer websocket clients. So they have websocket client which should be 24/7 connected and with the 2h limit we and they have to include logic that no data is lost.

As this should scale very much we don't want to go with an EC2 based solution.

Thanks

2개 답변
0
수락된 답변

Regardless of the solution you eventually choose, you should take into consideration that connections can be closed. It can be by the server, like the case with API Gateway, ir it can be any other network issue that may cause the connection to break.

For this reason, the fact that API Gateway closes the connection every two hours should not be an issue. The client should recreate the connection when it detects that the connection is closed. Also, the server side should save messages in a database if currently there are no open connection to the client. When the connection is established, the server should check if there are any pending messages for that client.

Saying that, did you check the option of using IoT Core? It has a 24 hours connection limit and may be more appropriate for IoT use cases.

profile pictureAWS
전문가
Uri
답변함 일 년 전
profile picture
전문가
검토됨 4달 전
  • Sure, a connection loss can always occur. We are not quite sure if a 2h automatically reconnect cycle time is something common and therefore would be accepted from our customers. But we will start with this. Thanks

0

Given the description of the use case, I would consider using AWS IoT Core and not API Gateway as your backend. Not only AWS IoT Core provides MQTT over Secure Web Socket protocol with connections lasting 24hrs. MQTT client libraries normally manage the reconnection. You also get a fully managed, scalable and secure IoT service.

AWS
전문가
답변함 일 년 전

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

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

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