Erweiterungen

This commit is contained in:
2025-10-08 18:23:36 +02:00
parent b704f58683
commit b4e55cee82
13 changed files with 756 additions and 417 deletions

View File

@@ -133,11 +133,34 @@ Payload:
- User notifications: v1/users/<username>/notifications
Payload example:
{
"type": "broadcast|notification",
"type": "broadcast|notification",
"message": "...",
"timestamp": "2025-09-13T22:10:00"
}
## Chat Messaging (App ↔ Server)
Mobile apps exchange chat messages with the backend through dedicated topics. JSON samples can be
found under `src/main/resources/mqtt/chat`.
### App → Server
- **Topic:** `/server/{clientId}/message`
- **Payload example:** `src/main/resources/mqtt/chat/incoming-chat-message.json`
- **Required fields:** `sender`, `receiver`, `content`
- **Optional fields:** `jobId` (Mongo ObjectId), `jobNumber`
- Payloads missing required fields or containing invalid `jobId` values are rejected with a warning log.
### Server → App
- **Topic:** `/client/{receiver}/message`
- **Payload example:** `src/main/resources/mqtt/chat/outgoing-chat-message.json`
- **Notes:** `direction` (INCOMING/OUTGOING) and `messageType` (GENERAL/JOB_RELATED) mirror the
persisted message entity. `read` remains `false` until the receiver acknowledges the message via the
REST API.
### Quality of Service
- Chat topics inherit the global default QoS 2 (`app.mqtt.default-qos`).
- Messages are not retained; offline clients rely on QoS queueing on the broker.
Quality of Service & Retain
- QoS 2 (exactly once) is used by default server side for both inbound subscriptions and outbound publications.
- Retained messages are disabled by default to avoid stale updates.