Do I need to `ping` connected websocket connections?
<p>I would like to keep the Websocket connection alive for an undefined amount of time. The socket will ideally be sending data every so often but this is not assured, and I also would not like to make assumptions since a user can be in an idle state.</p>

<p>I have an object that stores references to all websocket connections. Would it be appropriate for me to schedule a function every x number of minutes? seconds? that basically iterates through all the connections, pings them and then discards those that haven't received pongs? Or do I need to enable a flag that automatically keeps the connection alive?</p>

<p>I am using the <a href="https://github.com/websockets/ws" rel="nofollow">ws</a> library on my server, but create websocket connections natively on the client.</p>