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) {
|
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(
|
const pendingTopicsSubscriptions = this.pendingTopicsSubscriptions.find(
|
||||||
(s) => s.wsKey === wsKey,
|
(s) => s.wsKey === wsKey,
|
||||||
);
|
);
|
||||||
@@ -1081,10 +1081,14 @@ export class WebsocketClient extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const subscriptionSuccess = isTopicSubscriptionSuccess(msg);
|
const subscriptionSuccess = isTopicSubscriptionSuccess(msg);
|
||||||
|
const splitRequestsIds = requestsIds.split(',');
|
||||||
if (!subscriptionSuccess) {
|
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);
|
this.removeTopicPendingSubscription(wsKey, req_id);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -1108,6 +1112,7 @@ export class WebsocketClient extends EventEmitter {
|
|||||||
pendingTopicsSubscriptions.rejector(failedSubscriptionsMessage);
|
pendingTopicsSubscriptions.rejector(failedSubscriptionsMessage);
|
||||||
this.clearTopicsPendingSubscriptions(wsKey);
|
this.clearTopicsPendingSubscriptions(wsKey);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private onWsClose(event, wsKey: WsKey) {
|
private onWsClose(event, wsKey: WsKey) {
|
||||||
|
|||||||
Reference in New Issue
Block a user