From 14096103256c3c955cdadb50107219daed5482e0 Mon Sep 17 00:00:00 2001 From: litvinenkow Date: Sun, 28 Nov 2021 19:33:59 +0400 Subject: [PATCH] Update binance_futures.js error undefined me --- exchange/binance_futures.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exchange/binance_futures.js b/exchange/binance_futures.js index 4d2ae998e..79f33380f 100644 --- a/exchange/binance_futures.js +++ b/exchange/binance_futures.js @@ -529,6 +529,8 @@ module.exports = class BinanceFutures { async initUserWebsocket() { let response; + const me = this; + try { response = await this.ccxtClient.fapiPublicPostListenKey(); } catch (e) { @@ -540,8 +542,7 @@ module.exports = class BinanceFutures { this.logger.error(`${me.getName()}: invalid listenKey response: ${JSON.stringify(response)}`); return undefined; } - - const me = this; + var ws = new WebSocket(`${this.getBaseWebsocketUrl()}/ws/${response.listenKey}`); ws.onerror = function(e) { me.logger.info(`${me.getName()}: Connection error: ${String(e)}`);