add check before connect on stream
This commit is contained in:
parent
54de7c6e84
commit
754fb16da0
|
@ -67,15 +67,19 @@ export function subscribeOnStream(
|
|||
quoteAddress: symbolInfo.quote_token,
|
||||
},
|
||||
}
|
||||
|
||||
if (!isOpen(socket)) {
|
||||
console.warn('Socket Closed')
|
||||
socket.addEventListener('open', (_event) => {
|
||||
if (!msg.data.baseAddress || msg.data.quoteAddress) return
|
||||
socket.send(JSON.stringify(msg))
|
||||
})
|
||||
return
|
||||
}
|
||||
console.warn('[subscribeBars birdeye]')
|
||||
socket.send(JSON.stringify(msg))
|
||||
if (msg.data.baseAddress && msg.data.quoteAddress) {
|
||||
socket.send(JSON.stringify(msg))
|
||||
}
|
||||
}
|
||||
|
||||
export function unsubscribeFromStream() {
|
||||
|
|
Loading…
Reference in New Issue