Skip to content

Commit

Permalink
fix: send response with nos sub active
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvolek committed Oct 20, 2021
1 parent ad548a4 commit cf823cb
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/server.ts
Expand Up @@ -226,14 +226,15 @@ wss.on('connection', (ws: Server.Ws) => {
const activeBlockSubIndex = activeSubscriptions.findIndex(i => i.type === 'block');

if (activeBlockSubIndex > -1) {
const message = prepareMessage(data.id, {
subscribed: false,
});

ws.send(message);
activeSubscriptions.splice(activeBlockSubIndex);
}

const message = prepareMessage(data.id, {
subscribed: false,
});

ws.send(message);

break;
}

Expand All @@ -255,11 +256,11 @@ wss.on('connection', (ws: Server.Ws) => {
type: 'addresses',
id: data.id,
});
}

const message = prepareMessage(data.id, { subscribed: true });
const message = prepareMessage(data.id, { subscribed: true });

ws.send(message);
}
ws.send(message);

break;
}
Expand All @@ -268,15 +269,16 @@ wss.on('connection', (ws: Server.Ws) => {
const activeAddressSubIndex = activeSubscriptions.findIndex(i => i.type === 'addresses');

if (activeAddressSubIndex > -1) {
const message = prepareMessage(data.id, {
subscribed: false,
});

ws.send(message);
addressedSubscribed = [];
activeSubscriptions.splice(activeAddressSubIndex);
}

const message = prepareMessage(data.id, {
subscribed: false,
});

ws.send(message);
addressedSubscribed = [];

break;
}

Expand Down

0 comments on commit cf823cb

Please sign in to comment.