fix(4.0.0-beta.1): fix backwards compatibility with req_id usage for ws subscribe/unsubscribe
This commit is contained in:
@@ -4,7 +4,6 @@ import https from 'https';
|
||||
|
||||
import {
|
||||
APIID,
|
||||
REST_CLIENT_TYPE_ENUM,
|
||||
RestClientOptions,
|
||||
RestClientType,
|
||||
getRestBaseUrl,
|
||||
|
||||
@@ -550,10 +550,18 @@ export class WebsocketClient extends BaseWebsocketClient<
|
||||
|
||||
switch (market) {
|
||||
case 'all': {
|
||||
const topics = requests.map((r) => r.topic);
|
||||
|
||||
// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values
|
||||
const req_id =
|
||||
['subscribe', 'unsubscribe'].includes(operation) && topics.length
|
||||
? topics.join('_')
|
||||
: this.getNewRequestId();
|
||||
|
||||
const wsEvent: WsRequestOperationBybit<WsTopic> = {
|
||||
req_id: this.getNewRequestId(),
|
||||
req_id: req_id,
|
||||
op: operation,
|
||||
args: requests.map((r) => r.topic),
|
||||
args: topics,
|
||||
};
|
||||
|
||||
const midflightWsEvent: MidflightWsRequestEvent<
|
||||
|
||||
Reference in New Issue
Block a user