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