fixed small bugs
This commit is contained in:
@@ -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 });
|
||||||
|
|||||||
Reference in New Issue
Block a user