How Can I add 'pings' to my websocket connection?

How can I add ‘pings’ to my websocket connection?

Do I need to add open new websocket via ‘ws’ npm? not from web3 websocket connection?

This varies depending on the websocket client library you are using

Couple good sources,

https://tools.ietf.org/html/rfc6455#section-5.5.2

The documentation for the specific websocket client library you are using should outline how best to handle this.