usdc options public ws test

This commit is contained in:
tiagosiebler
2022-09-16 13:13:49 +01:00
parent 28485c0068
commit d2ba5d3e01
9 changed files with 319 additions and 115 deletions

View File

@@ -61,15 +61,23 @@ export function getRestBaseUrl(
return exchangeBaseUrls.testnet;
}
export function isWsPong(response: any) {
if (response.pong || response.ping) {
export function isWsPong(msg: any): boolean {
if (!msg) {
return false;
}
if (msg.pong || msg.ping) {
return true;
}
if (msg['op'] === 'pong') {
return true;
}
return (
response.request &&
response.request.op === 'ping' &&
response.ret_msg === 'pong' &&
response.success === true
msg.request &&
msg.request.op === 'ping' &&
msg.ret_msg === 'pong' &&
msg.success === true
);
}