node_modules/binance/lib/websocket-client.js
/**
     * Subscribe to USD-M Futures user data stream - listen key is automatically generated.
     */
Subscribe to USD-M Futures user data stream - listen key is automatically generated.
Subscribe to USD - M Futures user data stream - listen key is automatically generated .
subscribeUsdFuturesUserDataStream(isTestnet, forceNewConnection, isReconnecting) {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                const { listenKey } = yield this.getUSDMRestClient(isTestnet).getFuturesUserDataListenKey();
                const market = isTestnet ? 'usdmTestnet' : 'usdm';
                const streamName = 'userData';
                const wsKey = [market, streamName, listenKey].join('_');
                this.setWsState(wsKey, isReconnecting ? READY_STATE_RECONNECTING : READY_STATE_CONNECTING);
                const ws = this.connectToWsUrl(this.getWsBaseUrl(market, wsKey) + `/ws/${listenKey}`, wsKey, forceNewConnection);
                this.setKeepAliveListenKeyTimer(listenKey, market, ws, wsKey, undefined, isTestnet);
                return ws;
            }
            catch (e) {
                this.logger.error(`Failed to get USDM Futures user data listen key`, Object.assign(Object.assign({}, loggerCategory), { error: e }));
            }
        });
    }
subscribeUsdFuturesUserDataStream ( isTestnet , forceNewConnection , isReconnecting ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { try { const { listenKey } = yield this . getUSDMRestClient ( isTestnet ) . getFuturesUserDataListenKey ( ) ; const market = isTestnet ? 'usdmTestnet' : 'usdm' ; const streamName = 'userData' ; const wsKey = [ market , streamName , listenKey ] . join ( '_' ) ; this . setWsState ( wsKey , isReconnecting ? READY_STATE_RECONNECTING : READY_STATE_CONNECTING ) ; const ws = this . connectToWsUrl ( this . getWsBaseUrl ( market , wsKey ) + ` ${ listenKey } ` , wsKey , forceNewConnection ) ; this . setKeepAliveListenKeyTimer ( listenKey , market , ws , wsKey , undefined , isTestnet ) ; return ws ; } catch ( e ) { this . logger . error ( ` ` , Object . assign ( Object . assign ( { } , loggerCategory ) , { error : e } ) ) ; } } ) ; }
Subscribe to USD-M Futures user data stream - listen key is automatically generated.
Subscribe to USD - M Futures user data stream - listen key is automatically generated .
// Necessary so client knows this is a reconnect // Start & store timer to keep alive listen key (and handle expiration)