fixed small bugs

This commit is contained in:
peepopoggers
2021-01-29 11:49:19 +00:00
parent c18155f445
commit fb16feac75

View File

@@ -67,17 +67,16 @@ export class WebsocketClient extends EventEmitter {
}; };
if (!this.options.linear) { if (this.options.linear === true) {
this.client = new InverseClient(undefined, undefined, this.options.livenet, this.options.restOptions, this.options.requestOptions);
}else{
this.client = new LinearClient(undefined, undefined, this.options.livenet, this.options.restOptions, this.options.requestOptions); 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._subscriptions = new Set();
this._connect(); this._connect();
} }
subscribe(topics) { subscribe(topics) {
if (!Array.isArray(topics)) topics = [topics]; if (!Array.isArray(topics)) topics = [topics];
topics.forEach(topic => this._subscriptions.add(topic)); topics.forEach(topic => this._subscriptions.add(topic));
@@ -196,7 +195,7 @@ export class WebsocketClient extends EventEmitter {
_wsOpenHandler() { _wsOpenHandler() {
if (this.readyState === READY_STATE_CONNECTING) { 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'); this.emit('open');
} else if (this.readyState === READY_STATE_RECONNECTING) { } else if (this.readyState === READY_STATE_RECONNECTING) {
this.logger.info('Websocket reconnected', { category: 'bybit-ws', livenet: this.options.livenet }); this.logger.info('Websocket reconnected', { category: 'bybit-ws', livenet: this.options.livenet });