#218 Returning a promise when subscribing to topics

This commit is contained in:
Caius Citiriga
2023-05-09 03:37:26 +02:00
parent 065f72472e
commit 4b854ddb39
4 changed files with 224 additions and 58 deletions

View File

@@ -124,6 +124,32 @@ export function isWsPong(msg: any): boolean {
);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function isTopicSubscriptionConfirmation(msg: any): boolean {
if (!msg) {
return false;
}
if (!msg['op'] || msg['op'] !== 'subscribe') {
return false;
}
return true;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function isTopicSubscriptionSuccess(msg: any): boolean {
if (!msg) {
return false;
}
if (!msg['op'] || msg['op'] !== 'subscribe') {
return false;
}
return msg['success'] === true;
}
export const APIID = 'bybitapinode';
/**