Web3.js and websocket on ubuntu quietly loses connection

I have a node.js client in a docker container connecting to infura via websocket, using the web3.js library. rinkeby network

On local development on my MacOS, the code works ok and i can capture any .close events, and restart the websocket.

However, when I run the same docker container on an ubuntu or debian ec2 instance, the connection quietly closes without the firing the close event. It leaves the connection in a limbo state where I can not get notifications. I believe it has something to do with ubuntu timing out the network connection in a way that web3.js is not correctly capturing, and as far as I can read from the docs, web3 does not support any type of ping mechanism.

Has anyone else encountered this before? Any suggestions?

This appears to be a web3 issue, have you reached out to that community?