Websocket connection times out after 10-15 minutes despite replying to PINGs

I tried adding something similar where my code will wait roughly 3 minutes for a ping, and then send it’s own, but I still get the same result. I’ve been having this issue for over a week now, so if it’s a server issue I’d be kinda surprised.