Skip to main content

Notifications

This section documents the notification endpoints of the MiseOS API.

MiseOS uses WebSockets to push real-time updates to connected clients.
The notification system supports two delivery flows:

  • Admin broadcast for HEAD_CHEF and SOUS_CHEF
  • Direct staff notifications for individual kitchen users

Notification flow
#

flowchart LR

Client -->|WebSocket connect| NotificationServer
NotificationServer -->|Admin broadcast| AdminClients
NotificationServer -->|Direct notification| StaffClient
NotificationServer -->|REST snapshot| Dashboard

Notification Endpoints
#

MethodURLAuth
WS/notificationsKITCHEN_STAFF
GET/notifications/snapshotHEAD_CHEF, SOUS_CHEF

WebSocket connection
#

Clients must connect with a valid JWT in the Authorization header:

wss://miseos.corral.dk/api/v1/notifications
Authorization: Bearer <token>

Session registration behavior:

  • HEAD_CHEF, SOUS_CHEF → registered as admin sessions (receive broadcast updates)
  • Other kitchen staff (e.g. LINE_COOK) → registered as staff sessions (receive direct user notifications)

If the token is missing or invalid, the server closes the connection with close code 1008 (policy violation).


Admin broadcast message
#

Sent to all connected admin sessions when pending counts change.

{
  "notificationType": "PENDING_COUNT_UPDATED",
  "category": "INGREDIENT_REQUEST",
  "count": 3,
  "timestamp": "2026-03-27 10:15"
}

Notification types (admin):

  • NEW_INGREDIENT_REQUEST
  • NEW_DISH_SUGGESTION
  • PENDING_COUNT_UPDATED

Category values:

  • INGREDIENT_REQUEST
  • DISH_SUGGESTION

Staff direct message
#

Sent to a specific user when their request/suggestion is reviewed.

{
  "notificationType": "REQUEST_APPROVED",
  "category": "INGREDIENT_REQUEST",
  "requestId": 5,
  "itemName": "Frisk Dild",
  "reviewedBy": {
    "id": 1,
    "firstName": "Gordon",
    "lastName": "Ramsay"
  },
  "timestamp": "2026-03-27 10:20"
}

Notification types (staff):

  • REQUEST_APPROVED
  • REQUEST_REJECTED
  • SUGGESTION_APPROVED
  • SUGGESTION_REJECTED

Category values:

  • INGREDIENT_REQUEST
  • DISH_SUGGESTION

GET /notifications/snapshot
#

Returns current pending counters for dashboard badges.
Recommended flow: call this once on page load, then rely on WebSocket updates.

Example Request
#

curl -H "Authorization: Bearer <token>" \
https://miseos.corral.dk/api/v1/notifications/snapshot

Response 200
#

{
  "pendingDishSuggestions": 3,
  "pendingIngredientRequests": 7,
  "totalPending": 10
}

Errors

StatusCause
401Missing or invalid token
403Insufficient role (not HEAD_CHEF/SOUS_CHEF)

Delivery notes
#

  • Notifications are fire-and-forget.
  • If a user is offline when a message is sent, it is not queued.
  • Source-of-truth state is always available through REST endpoints.
  • The current implementation allows one active staff WebSocket session per user.
  • If a new connection is established, the previous session is replaced.