re-establish subscriptions after ws disconnect

This commit is contained in:
tim
2025-02-26 17:28:23 -04:00
parent 2e49346533
commit f5f53c6af4
3 changed files with 16 additions and 2 deletions

View File

@@ -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', () => {