Erweiterungen
This commit is contained in:
@@ -17,6 +17,7 @@ Das System bietet folgende STOMP-Funktionalitäten:
|
||||
- **`/app/message`** - Allgemeine Nachrichten
|
||||
- **`/app/job/status`** - Job-Status-Updates
|
||||
- **`/app/device/location`** - Gerätestandort-Updates
|
||||
- **`/app/auth/login`** - Anmeldung eines App-Users (Payload: { email, password })
|
||||
|
||||
#### Ausgehende Nachrichten (Server → Client)
|
||||
- **`/topic/messages`** - Broadcast aller allgemeinen Nachrichten
|
||||
@@ -75,6 +76,19 @@ stompClient.send('/app/device/location', {}, JSON.stringify({
|
||||
longitude: 13.4050,
|
||||
accuracy: 10
|
||||
}));
|
||||
|
||||
// Anmeldung eines App-Users
|
||||
// Zuerst die Antwort-Warteschlange abonnieren (user-spezifisch)
|
||||
const authSubscription = stompClient.subscribe('/user/queue/auth', function(message) {
|
||||
const resp = JSON.parse(message.body);
|
||||
console.log('Login-Antwort:', resp);
|
||||
});
|
||||
|
||||
// Login-Request senden
|
||||
stompClient.send('/app/auth/login', {}, JSON.stringify({
|
||||
email: 'user@example.com',
|
||||
password: 'geheimesPasswort'
|
||||
}));
|
||||
```
|
||||
|
||||
## Backend-Integration
|
||||
@@ -92,6 +106,23 @@ messageController.sendNotificationToUser("username", "Neue Aufgabe verfügbar");
|
||||
messageController.sendBroadcastMessage("Systemwartung in 10 Minuten");
|
||||
```
|
||||
|
||||
## Zeroconf (mDNS) Veröffentlichung
|
||||
|
||||
Die Anwendung veröffentlicht die STOMP-Schnittstelle via Zeroconf (DNS-SD/mDNS), sofern verfügbar. Es wird der Service-Typ `_stomp._tcp.local.` mit folgenden TXT-Records publiziert:
|
||||
- path = Pfad für SockJS-Endpoint (Standard: /ws)
|
||||
- websocket = Pfad für nativen WebSocket (Standard: /websocket)
|
||||
- protocol = "stomp"
|
||||
|
||||
Clients können per Bonjour/mDNS nach `_stomp._tcp` suchen und erhalten Port und Metadaten.
|
||||
|
||||
Hinweise:
|
||||
- Die Implementierung nutzt JmDNS, falls die Bibliothek auf dem Klassenpfad vorhanden ist. In Umgebungen ohne JmDNS bleibt Zeroconf stillschweigend deaktiviert (es wird ein Hinweis im Log ausgegeben).
|
||||
- Konfigurierbare Properties:
|
||||
- app.zeroconf.enabled (default: true)
|
||||
- app.zeroconf.serviceName (default: votianlt-stomp)
|
||||
- app.stomp.wsPath (default: /ws)
|
||||
- app.stomp.websocketPath (default: /websocket)
|
||||
|
||||
## Konfiguration
|
||||
|
||||
Die STOMP-Konfiguration befindet sich in:
|
||||
|
||||
Reference in New Issue
Block a user