From fb16feac755a0e43d9566abc2d12566f51be1ce9 Mon Sep 17 00:00:00 2001 From: peepopoggers <72892531+peepopoggers@users.noreply.github.com> Date: Fri, 29 Jan 2021 11:49:19 +0000 Subject: [PATCH] fixed small bugs --- src/websocket-client.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/websocket-client.ts b/src/websocket-client.ts index e17e6eb..546e8d4 100644 --- a/src/websocket-client.ts +++ b/src/websocket-client.ts @@ -67,17 +67,16 @@ export class WebsocketClient extends EventEmitter { }; - if (!this.options.linear) { - this.client = new InverseClient(undefined, undefined, this.options.livenet, this.options.restOptions, this.options.requestOptions); - }else{ + if (this.options.linear === true) { this.client = new LinearClient(undefined, undefined, this.options.livenet, this.options.restOptions, this.options.requestOptions); + }else{ + this.client = new InverseClient(undefined, undefined, this.options.livenet, this.options.restOptions, this.options.requestOptions); } this._subscriptions = new Set(); this._connect(); } - subscribe(topics) { if (!Array.isArray(topics)) topics = [topics]; topics.forEach(topic => this._subscriptions.add(topic)); @@ -196,7 +195,7 @@ export class WebsocketClient extends EventEmitter { _wsOpenHandler() { if (this.readyState === READY_STATE_CONNECTING) { - this.logger.info('Websocket connected', { category: 'bybit-ws', livenet: this.options.livenet }); + this.logger.info('Websocket connected', { category: 'bybit-ws', livenet: this.options.livenet, linear: this.options.linear }); this.emit('open'); } else if (this.readyState === READY_STATE_RECONNECTING) { this.logger.info('Websocket reconnected', { category: 'bybit-ws', livenet: this.options.livenet });