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 réponses
0
Réponse acceptée

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
EXPERT
Uri
répondu il y a un an
profile picture
EXPERT
vérifié il y a 4 mois
  • 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
EXPERT
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions