Fix: Umstellung auf Socket.io für alle Views und Verbesserung der Event-Registrierung

Änderung:
- Alle Views wurden aktualisiert, um den Daemon WebSocket zu deaktivieren und stattdessen Socket.io für die Event-Registrierung zu verwenden.
- Eine neue Methode `setupSocketEvents` wurde hinzugefügt, um die Socket.io-Events zu registrieren und Protokollausgaben für den Status der Registrierung bereitzustellen.
- Die Logik zur Handhabung von WebSocket-Events wurde vereinfacht und verbessert, um die Stabilität und Nachvollziehbarkeit zu erhöhen.

Diese Anpassung sorgt für eine konsistentere Handhabung von WebSocket-Events und verbessert die Benutzererfahrung durch zuverlässigere Datenaktualisierungen.
This commit is contained in:
Torsten Schulz (local)
2025-09-08 12:06:56 +02:00
parent 975a1dd7ca
commit 917b04fb5e
10 changed files with 159 additions and 49 deletions

View File

@@ -194,18 +194,26 @@ export default {
}
},
computed: {
...mapState(['socket', 'daemonSocket'])
...mapState(['socket'])
},
async mounted() {
await this.loadFamilyData();
await this.loadGifts();
await this.loadMoodAffects();
await this.loadCharacterAffects();
if (this.daemonSocket) {
this.daemonSocket.addEventListener('message', this.handleDaemonMessage);
}
this.setupSocketEvents();
},
methods: {
setupSocketEvents() {
if (this.socket) {
this.socket.on('falukantUpdateStatus', this.loadFamilyData);
this.socket.on('familychanged', this.loadFamilyData);
console.log('✅ FamilyView: Socket.io Events registriert');
} else {
console.log('⚠️ FamilyView: Socket.io noch nicht verfügbar');
setTimeout(() => this.setupSocketEvents(), 1000);
}
},
async loadFamilyData() {
try {
const response = await apiClient.get('/api/falukant/family');