How to keep a golang.org/x/net/websocket open? <p>I'm naively use <a href="https://github.com/kaihendry/WebSocketHook/blob/master/server/main.go#L22">_, err := ws.Read(msg)</a> to keep a Web socket open in my code. I don't think it works reliably.</p> <p>In other code I've noticed people doing a <a href="https://github.com/skarnecki/gotail/blob/master/app.go#L56">sleep loop</a>. What's the correct way to keep a Web socket open &amp; stable? I assume the underlying library does ping/pongs?</p> <p>Update: I'm pretty confident that the <a href="https://github.com/kaihendry/WebSocketHook/blob/fd3fc976bf1ce5865b48005e3d4024682a1c9533/client/client.go">client.go</a> is to blame since it doesn't seem to redial after a disconnect is seen on the server. I made <a href="https://youtu.be/hmOI3MIIXIM">a video demonstrating the issue</a>.</p>