Events and State websocket API appears to be timing out after about 20 minutes of inactivity?

We are attempting to use the Events and State API from a Python comnmand-line application. Our code is based on the

EventsAndStateWebSocketApiPython protocol sample.

We boot a test server and can query the API on that machine fine. However, if we don’t send a query for around 20 minutes, subsequent attempts then result in the websocket connection throwing an exception with “server rejected WebSocket connection: HTTP 500”. If we restart the machine, it accepts connections again.

As a test I set up a loop to send the query every five minutes, and the API responded as expected. So it looks like there’s some sort of inactivity timeout.

Is this the case, and if so, is there a mechanism for configuring that timeout? Or ideally turning it off so the API always accepts requests?

(The server is freshly provisioned and AFAIK there’s nothing like antivirus or firewall which could be getting in the way. And like I say, it does accept websocket connections initially.)

Thanks for any assistance.

I had to consult a Milestone developer that was involved with the Events and State websocket API and samples, here is what I got:

-

Maybe we at Milestone haven’t specifically tested Idle timeout using the Python Sample, thus there may be a shortage in the sample. From the top of my head, the connection can be kept alive by means of low level messages ‘ping’ / ‘pong’. In the .Net implementation, the ping/pong is enabled by default, but that may not be the case in Python, and thus we may have missed this.

Unfortunately there is no way of disabling or extending idle timeout in the Event server / API gateway, so this needs to be solved client side.