Skip to content

WebSocket Reconnect

Jon Eyrick edited this page Jan 6, 2018 · 3 revisions

All WebSockets will now reconnect automatically. No extra code is required

You can also disable this behavior:

binance.options({
	'APIKEY': '<your key>',
	'APISECRET': '<your secret>',
	'reconnect': false
});

You can store a reference to each ws object:

// List all endpoints
let endpoints = binance.websockets.subscriptions();
for ( let endpoint in endpoints ) {
	console.log(endpoint);
	//binance.websockets.terminate(endpoint);
}

Now you can terminate each websocket endpoint by the id:

binance.websockets.terminate('ethbtc@kline_1m');
Clone this wiki locally