add wss back
This commit is contained in:
parent
13c86dbd77
commit
fc93259f1e
@ -305,7 +305,7 @@ onMount(async () => {
|
|||||||
//const endTime = currentDateTime.set({ hour: 22, minute: 0 });
|
//const endTime = currentDateTime.set({ hour: 22, minute: 0 });
|
||||||
// Check if it's not a weekend and the current time is within the specified range
|
// Check if it's not a weekend and the current time is within the specified range
|
||||||
|
|
||||||
//await websocketRealtimeData()
|
await websocketRealtimeData()
|
||||||
|
|
||||||
|
|
||||||
// Add a scroll event listener
|
// Add a scroll event listener
|
||||||
|
|||||||
@ -314,12 +314,12 @@ async function fetchPortfolio()
|
|||||||
//const endTime = currentDateTime.set({ hour: 22, minute: 0 });
|
//const endTime = currentDateTime.set({ hour: 22, minute: 0 });
|
||||||
// Check if it's not a weekend and the current time is within the specified range
|
// Check if it's not a weekend and the current time is within the specified range
|
||||||
|
|
||||||
/*
|
|
||||||
if ($isOpen) //&& currentDateTime > startTime && currentDateTime < endTime
|
if ($isOpen) //&& currentDateTime > startTime && currentDateTime < endTime
|
||||||
{
|
{
|
||||||
await websocketRealtimeData()
|
await websocketRealtimeData()
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// Add a scroll event listener
|
// Add a scroll event listener
|
||||||
window.addEventListener('scroll', handleScroll);
|
window.addEventListener('scroll', handleScroll);
|
||||||
|
|||||||
@ -374,11 +374,12 @@ async function websocketRealtimeData() {
|
|||||||
let newData = [];
|
let newData = [];
|
||||||
try {
|
try {
|
||||||
socket = new WebSocket(data?.wsURL + "/options-flow-reader");
|
socket = new WebSocket(data?.wsURL + "/options-flow-reader");
|
||||||
|
/*
|
||||||
socket.addEventListener("open", () => {
|
socket.addEventListener("open", () => {
|
||||||
const ids = rawData.map(item => item.id);
|
const ids = rawData.map(item => item.id);
|
||||||
sendMessage(JSON.stringify({ ids }));
|
sendMessage(JSON.stringify({ ids }));
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
socket.addEventListener('message', (event) => {
|
socket.addEventListener('message', (event) => {
|
||||||
previousCallVolume = displayCallVolume ?? 0;
|
previousCallVolume = displayCallVolume ?? 0;
|
||||||
@ -389,14 +390,14 @@ async function websocketRealtimeData() {
|
|||||||
newData.forEach((item) => {
|
newData.forEach((item) => {
|
||||||
item.dte = daysLeft(item?.date_expiration);
|
item.dte = daysLeft(item?.date_expiration);
|
||||||
});
|
});
|
||||||
rawData = [...newData, ...rawData];
|
rawData = newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ruleOfList?.length !== 0 || filterQuery?.length !== 0) {
|
if (ruleOfList?.length !== 0 || filterQuery?.length !== 0) {
|
||||||
shouldLoadWorker.set(true);
|
shouldLoadWorker.set(true);
|
||||||
}
|
}
|
||||||
if (previousCallVolume !== displayCallVolume && !muted && audio) {
|
if (previousCallVolume !== displayCallVolume && !muted && audio) {
|
||||||
audio.play();
|
audio?.play();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error processing WebSocket message:', e);
|
console.error('Error processing WebSocket message:', e);
|
||||||
@ -463,11 +464,10 @@ function daysLeft(targetDate) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
/*
|
|
||||||
if ($isOpen) {
|
if ($isOpen) {
|
||||||
await websocketRealtimeData();
|
await websocketRealtimeData();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -226,11 +226,11 @@ async function fetchPortfolio()
|
|||||||
//SellTrade = (await import('$lib/components/SellTrade.svelte')).default;
|
//SellTrade = (await import('$lib/components/SellTrade.svelte')).default;
|
||||||
PriceAlert = (await import("$lib/components/PriceAlert.svelte")).default;
|
PriceAlert = (await import("$lib/components/PriceAlert.svelte")).default;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if ($isOpen) {
|
if ($isOpen) {
|
||||||
//&& currentDateTime > startTime && currentDateTime < endTime
|
//&& currentDateTime > startTime && currentDateTime < endTime
|
||||||
await websocketRealtimeData();
|
await websocketRealtimeData();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user