Umbau broekr auf client-id

This commit is contained in:
concierge committed 2026-11-01 21:59:11 +01:00
1 parent 268e150f2b
commit a95204b8d6
17 files changed
+649 -388

No files matched your search

+16 -5
View File
@@ -1154,7 +1154,9 @@ function connectWebSocket() {
ws.send(JSON.stringify({
code: 0,
msg: token,
session_id: window.CMBNET_CLIENT_SESSION_ID || ''
client_id: window.CMBNET_CLIENT_ID
|| window.CMBNET_CLIENT_SESSION_ID
|| ''
}));
// Fallback für ältere Server, die noch keine Code-0-Bestätigung
@@ -1326,7 +1328,9 @@ function parseFlexibleTimestamp(value) {
function handleWs(event) {
let message;
try { message = JSON.parse(event.data); } catch(e) { return; }
console.debug('[WS RX]', message);
if (message.code === 0) {
state.authenticated = true;
flushWsOutbox();
@@ -1356,6 +1360,8 @@ function handleWs(event) {
state.currentPolyline.setStyle({color: STREET_COLORS[street.state] || STREET_COLORS.unbearbeitet});
}
buildStreetList();
} else {
console.warn('[WS] Code 100: Straße nicht im lokalen Zustand', p);
}
}
} catch(e) {}
@@ -1365,12 +1371,17 @@ function handleWs(event) {
const p = typeof message.msg === 'string' ? JSON.parse(message.msg) : message.msg;
const gid = Number(p.group_id || message.receiver_id);
const g = state.groupById.get(gid);
if (g && p.lat && p.lon) {
g.last_lat = p.lat;
g.last_lon = p.lon;
const lat = Number(p.lat);
const lon = Number(p.lon);
if (g && Number.isFinite(lat) && Number.isFinite(lon)
&& p.lat !== null && p.lon !== null) {
g.last_lat = lat;
g.last_lon = lon;
g.last_pos_ts = parseFlexibleTimestamp(p.ts) || Date.now();
g.last_pos_at = new Date(g.last_pos_ts).toISOString();
if (viewMode === 'mobile_dispatcher') showAllGroupPositions();
} else if (!g) {
console.warn('[WS] Code 300: Gruppe nicht im lokalen Zustand', p);
}
} catch(e) {}
} else if (message.code === 2000 || message.code === 1000 || message.code === 1100) {