WebSocket stabiler gemacht mit Puffern beim Broker

This commit is contained in:
concierge committed 2026-10-31 09:01:44 +01:00
1 parent 12523ddd0a
commit c793e8b16d
10 files changed
+533 -37

No files matched your search

+13 -1
View File
@@ -125,7 +125,13 @@
adminSocket = ws;
ws.addEventListener('open', () => {
ws.send(JSON.stringify({code: 0, msg: data.token}));
ws.send(JSON.stringify({
code: 0,
msg: {
token: data.token,
session_id: window.CMBNET_CLIENT_SESSION_ID || ''
}
}));
});
ws.addEventListener('message', event => {
@@ -135,6 +141,12 @@
} catch (error) {
return;
}
if (Number(message.code) === 1) {
if (ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify({code: 2, msg: 'pong'}));
}
return;
}
if (Number(message.code) !== 99) return;
const text = typeof message.msg === 'string'
? message.msg
+1 -1
View File
@@ -5,7 +5,7 @@
* damit er sowohl die mobilen Views als auch die statischen Assets
* kontrolliert. Der Cache-Name wird pro App-Wurzel gebildet.
*/
const VERSION = 'cmbnet-pwa-v6';
const VERSION = 'cmbnet-pwa-v7';
const BASE = new URL('./', self.location).href;
const SHELL_CACHE = `${VERSION}-shell`;
const TILE_CACHE = `${VERSION}-tiles`;
+7 -1
View File
@@ -2701,7 +2701,13 @@ async function connectWebSocket() {
dispatcherState.ws = ws;
ws.addEventListener('open', () => {
ws.send(JSON.stringify({code: 0, msg: token}));
ws.send(JSON.stringify({
code: 0,
msg: {
token,
session_id: window.CMBNET_CLIENT_SESSION_ID || ''
}
}));
dispatcherState.authenticated = true;
setConnectionStatus('Verbunden', 'connected');
dispatcherState.lastCode0ReceivedAt = Date.now();
+7 -1
View File
@@ -1105,7 +1105,13 @@ function connectWebSocket() {
const ws = new WebSocket(wsUrl);
state.ws = ws;
ws.addEventListener('open', () => {
ws.send(JSON.stringify({code: 0, msg: token}));
ws.send(JSON.stringify({
code: 0,
msg: {
token,
session_id: window.CMBNET_CLIENT_SESSION_ID || ''
}
}));
state.authenticated = true;
});
ws.addEventListener('message', handleWs);