I am using API Gateway websocket connection and I have read this limits:
https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html
It says the Connection duration for WebSocket API limits is 2 hours. Does this mean I can't keep the connection connected for more than 2 hours? If yes, what is the workaround for that? Should I have to re-establish the connection every 2 hours in order to keep it connected?
However, the connection between a client and your WebSocket app closes when no traffic is sent between them for 60 seconds.
If the Pong frame isn't received, websockets considers the connection broken and closes it. This mechanism serves two purposes: It creates a trickle of traffic so that the TCP connection isn't idle and network infrastructure along the path keeps it open (“keepalive”).
I resolved this issue by implementing reconnection mechanism from client. Client simply reconnects to the server once the connection is dropped by API gateway after 2 hours. Found this as a recommended solution at multiple places.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With