Änderung: Verbesserung der Socket.io-Integration und Anpassung der Benutzer-ID-Übertragung
Änderungen: - Die Logik zur Übertragung der Benutzer-ID an den Socket wurde aktualisiert, um die Verwendung von `hashedId` zu unterstützen. - In `BranchView.vue` wurde die Socket-Verbindung um zusätzliche Live-Events erweitert und die Handhabung der Socket-Events optimiert. - Protokollausgaben wurden hinzugefügt, um die Nachverfolgbarkeit der Socket-Interaktionen zu verbessern. Diese Anpassungen erhöhen die Flexibilität und Robustheit der Socket.io-Integration in der Anwendung.
This commit is contained in:
@@ -55,7 +55,7 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['daemonSocket']),
|
||||
...mapState(['socket', 'daemonSocket']),
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
@@ -72,7 +72,7 @@ export default {
|
||||
this.selectMainBranch();
|
||||
}
|
||||
|
||||
// Live-Socket-Events
|
||||
// Live-Socket-Events (Daemon WS)
|
||||
[
|
||||
"production_ready", "stock_change", "price_update",
|
||||
"director_death", "production_started", "selled_items",
|
||||
@@ -91,10 +91,20 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Live-Socket-Events (Backend Socket.io)
|
||||
if (this.socket) {
|
||||
this.socket.on('falukantUpdateStatus', (data) => this.handleEvent({ event: 'falukantUpdateStatus', ...data }));
|
||||
this.socket.on('falukantBranchUpdate', (data) => this.handleEvent({ event: 'falukantBranchUpdate', ...data }));
|
||||
}
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
// Daemon WebSocket wird automatisch beim Logout geschlossen
|
||||
if (this.socket) {
|
||||
this.socket.off('falukantUpdateStatus');
|
||||
this.socket.off('falukantBranchUpdate');
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user