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
回答済み 1年前
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
エキスパート
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ