handling multiple subscriptions confirmations received at once
This commit is contained in:
@@ -1070,7 +1070,7 @@ export class WebsocketClient extends EventEmitter {
|
||||
}
|
||||
|
||||
private updatePendingTopicSubscriptionStatus(wsKey: string, msg: any) {
|
||||
const req_id = msg['req_id'] as string;
|
||||
const requestsIds = msg['req_id'] as string;
|
||||
const pendingTopicsSubscriptions = this.pendingTopicsSubscriptions.find(
|
||||
(s) => s.wsKey === wsKey,
|
||||
);
|
||||
@@ -1081,10 +1081,14 @@ export class WebsocketClient extends EventEmitter {
|
||||
}
|
||||
|
||||
const subscriptionSuccess = isTopicSubscriptionSuccess(msg);
|
||||
const splitRequestsIds = requestsIds.split(',');
|
||||
if (!subscriptionSuccess) {
|
||||
pendingTopicsSubscriptions.failedTopicsSubscriptions.add(req_id);
|
||||
splitRequestsIds.forEach((req_id) =>
|
||||
pendingTopicsSubscriptions.failedTopicsSubscriptions.add(req_id),
|
||||
);
|
||||
}
|
||||
|
||||
splitRequestsIds.forEach((req_id) => {
|
||||
this.removeTopicPendingSubscription(wsKey, req_id);
|
||||
|
||||
if (
|
||||
@@ -1108,6 +1112,7 @@ export class WebsocketClient extends EventEmitter {
|
||||
pendingTopicsSubscriptions.rejector(failedSubscriptionsMessage);
|
||||
this.clearTopicsPendingSubscriptions(wsKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private onWsClose(event, wsKey: WsKey) {
|
||||
|
||||
Reference in New Issue
Block a user