- Newest
- Most votes
- Most comments
Okay, this latest issue was actually my fault - apparently if you have a timeout on a ReceiveAsync() or SendAsync() then it aborts the whole websocket, by design, so my 30s timeout was making it seem like a keepalive issue. False alarm!
I have discovered that this happens in the us-west-2 region but not in us-east-1. Those are the only regions I tried. Steps to reproduce:
- Create a new lambda function (python 3.7), accept all the defaults and publish it.
- Create a new API Gateway websocket API.
- Route the $connect function to your lambda function.
- Deploy the API.
- Run my python code from above using your websocket URL.
For me, in us-west-2 the connection reliably closes after ping_interval seconds but in us-east-1 it stays open. Am I just confusing myself or is something misconfigured on Amazon's side?
Edited by: F. Spiral on Apr 3, 2019 2:00 PM
Well, this problem seems to have fixed itself for now. This was happening for about a day and then it suddenly started working fine.
This seems to be happening again, but now I'm using C# and System.Net.Websockets.ClientWebSocket. The KeepAliveInterval doesn't seem to matter this time. The websocket is disconnecting with status Aborted after 30 seconds of no activity, even if KeepAliveInterval is set to 5 seconds. How do I keep an API Gateway websocket alive without inventing random data to send? Is anyone else using ClientWebSocket and having this problem?
Relevant content
- asked 5 years ago
- asked 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago