Pricechart + Global Tooltips optimization + wsport fix.

This commit is contained in:
gerlofvanek
2025-03-03 21:09:46 +01:00
parent a5c3c692a0
commit 3489ebe908
6 changed files with 712 additions and 255 deletions

View File

@@ -357,17 +357,29 @@ const WebSocketManager = {
},
connect() {
if (this.ws?.readyState === WebSocket.OPEN) return;
if (this.ws?.readyState === WebSocket.OPEN) return;
try {
const wsPort = window.ws_port || '11700';
this.ws = new WebSocket(`ws://${window.location.hostname}:${wsPort}`);
this.setupEventHandlers();
} catch (error) {
console.error('WebSocket connection error:', error);
this.handleReconnect();
try {
let wsPort;
if (typeof getWebSocketConfig === 'function') {
const wsConfig = getWebSocketConfig();
wsPort = wsConfig?.port || wsConfig?.fallbackPort;
}
},
if (!wsPort && window.config?.port) {
wsPort = window.config.port;
}
if (!wsPort) {
wsPort = window.ws_port || '11701';
}
console.log("Using WebSocket port:", wsPort);
this.ws = new WebSocket(`ws://${window.location.hostname}:${wsPort}`);
this.setupEventHandlers();
} catch (error) {
console.error('WebSocket connection error:', error);
this.handleReconnect();
}
},
setupEventHandlers() {
this.ws.onopen = () => {