I found this very useful npm library called hollaex-node-lib
hollaex-node-lib - npm
I am using the websocket to get orderbook data so following the example code provided:
client.ws.on('message', (data) => {
data = JSON.parse(data);
console.log(data);
});
This works great and I am able to receive the events I subscribe too. However after couple of hours I get socket hang up
error and it disconnects.
How should I handle the error event handling and reconnect my websocket to keep the channel open?