Keep connection alive

Reconnect

You can enable auto reconnection with the option "reconnect".

const options = { reconnect: true };
const client = new obyte.Client('wss://obyte.org/bb', options);

Notify

Another way to keep the connection with the WebSocket node alive is to notify the node that your peer is awake every 10 sec.

setInterval(function() {
  client.api.heartbeat()
}, 10 * 1000);

Last updated