re-establish subscriptions after ws disconnect
This commit is contained in:
@@ -17,6 +17,16 @@ export function subOHLC( chainId, pool, period ) {
|
||||
}
|
||||
|
||||
|
||||
export function refreshOHLCSubs() {
|
||||
const keys = []
|
||||
for (const key of Object.keys(ohlcSubCounts)) {
|
||||
const [chainId, pool, period] = key.split('|')
|
||||
keys.push(`${pool}|${period}`)
|
||||
}
|
||||
socket.emit('subOHLCs', chainId, keys)
|
||||
}
|
||||
|
||||
|
||||
export function unsubOHLC( chainId, pool, period ) {
|
||||
const key = `${pool}|${period}`
|
||||
const ckey = `${chainId}|${key}`
|
||||
|
||||
@@ -318,7 +318,6 @@ const orders = computed(()=>{
|
||||
st.id = `${vault}|${index}`
|
||||
st.index = parseInt(index)
|
||||
// st.startTime = timestampString(st.startTime)
|
||||
console.log('starttime', st.startTime)
|
||||
/*
|
||||
o.tranches = o.tranches.map((tranche)=>{
|
||||
const t = {...tranche}
|
||||
|
||||
@@ -4,12 +4,17 @@ import {flushOrders} from "@/blockchain/wallet.js";
|
||||
import {parseElaboratedOrderStatus} from "@/blockchain/orderlib.js";
|
||||
import { DataFeed } from "./charts/datafeed";
|
||||
import {notifyFillEvent} from "@/notify.js";
|
||||
import {refreshOHLCSubs} from "@/blockchain/ohlcs.js";
|
||||
|
||||
export const socket = io(import.meta.env.VITE_WS_URL || undefined, {transports: ["websocket"]})
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log(new Date(), 'ws connected')
|
||||
useStore().connected = true
|
||||
const s = useStore();
|
||||
s.connected = true
|
||||
if (s.chainId && s.account)
|
||||
socket.emit('address', s.chainId, s.account)
|
||||
refreshOHLCSubs()
|
||||
})
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
|
||||
Reference in New Issue
Block a user