Resubscribe to subscriptions after reconnecting

This commit is contained in:
Stefan Aebischer
2019-09-16 15:04:02 +02:00
parent 5caa65fedf
commit 26a1354ec5
3 changed files with 38 additions and 14 deletions

View File

@@ -164,9 +164,11 @@ const PRIVATE_KEY = 'yyy';
const ws = new WebsocketClient({key: API_KEY, secret: PRIVATE_KEY});
ws.subscribe(['position', 'execution', 'trade']);
ws.subscribe('kline.BTCUSD.1m');
ws.on('open', function() {
ws.subscribe(['position', 'execution', 'trade']);
ws.subscribe('kline.BTCUSD.1m');
console.log('connection open');
});
ws.on('update', function(message) {