redis pub/sub fix
This commit is contained in:
18
chain.js
18
chain.js
@@ -5,11 +5,15 @@ export const chainInfo = JSON.parse(fs.readFileSync('../contract/version.json'))
|
||||
console.log('chainInfo', chainInfo)
|
||||
|
||||
export async function joinChain( socket, chainId ) {
|
||||
if (socket.chainId)
|
||||
socket.leave(socket.chainId)
|
||||
socket.join(chainId)
|
||||
socket.chainId = chainId
|
||||
const items = await marks.items(chainId);
|
||||
for (let [token,mark] of items)
|
||||
socket.emit('mark.usd', chainId, token, mark)
|
||||
try {
|
||||
if (socket.chainId)
|
||||
socket.leave(socket.chainId)
|
||||
socket.join(chainId)
|
||||
socket.chainId = chainId
|
||||
const items = await marks.items(chainId);
|
||||
for (let [token, mark] of items)
|
||||
socket.emit('mark.usd', chainId, token, mark)
|
||||
} catch (e) {
|
||||
console.error('joinChain', e)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user