ohlc pubsub bugfixes

This commit is contained in:
Tim
2024-03-14 22:27:55 -04:00
parent 5388611e94
commit e65651ae8a
2 changed files with 6 additions and 3 deletions

View File

@@ -18,11 +18,14 @@ export function unsubPools( socket, chainId, addresses ) {
}
export function subOHLCs( socket, chainId, poolPeriods) {
export async function subOHLCs( socket, chainId, poolPeriods) {
console.log('subOHLCs', chainId, poolPeriods)
for(const key of poolPeriods) {
const room = `${chainId}|${key}`;
socket.join(room)
socket.emit('ohlc', chainId, key, ohlcs[key])
const ohlc = await ohlcs.get(chainId,key);
console.log('got ohlc', ohlc)
socket.emit('ohlc', chainId, key, ohlc)
console.log('joined room', room)
}
}