Set Up Notifications with SignalR

Connect to the notification hub, recover missed inbox items, and handle origin metadata.

Set Up Notifications with SignalR

PixService notifications combine a durable inbox with live SignalR delivery. Use the inbox endpoints after login or reconnects, and keep the hub connected while the app is in the foreground.

Bootstrap

Call:

GET /v1/notifications/bootstrap

The response contains:

  • hubPath: the SignalR hub path, currently /sync-hub
  • unreadCount: the current unread count for the authenticated user

Connect to hubPath with the normal bearer token. Browser and mobile SignalR clients should pass the JWT as the access_token query-string token for WebSocket and SSE transports.

Inbox Endpoints

List notifications:

GET /v1/notifications?offset=0&limit=100

List only unread notifications:

GET /v1/notifications?unreadOnly=true

Get the unread count:

GET /v1/notifications/unread-count

Mark one notification as read:

PATCH /v1/notifications/{notificationId}/read

Mark selected notifications as read:

POST /v1/notifications/read
{
  "notificationIds": [
    "22222222-2222-2222-2222-222222222222"
  ]
}

Mark all as read:

{
  "all": true
}

Hub Events

Subscribe to:

  • NotificationReceived
  • DocumentUploaded
  • StateUpdated
  • PositionChanged

NotificationReceived sends one NotificationDto payload. Spatial sync events include the related location ID and the same notification payload.

To receive location-scoped sync events, call:

JoinLocation(locationId)

Call LeaveLocation(locationId) when the view is closed.

Origin Metadata

Notifications can include an origin object:

{
  "type": "spatial-document",
  "id": "22222222-2222-2222-2222-222222222222",
  "url": "/spatial/locations/33333333-3333-3333-3333-333333333333/documents/22222222-2222-2222-2222-222222222222",
  "organizationId": "11111111-1111-1111-1111-111111111111",
  "locationId": "33333333-3333-3333-3333-333333333333",
  "documentId": "22222222-2222-2222-2222-222222222222",
  "data": {
    "contentType": "application/pdf"
  }
}

Use origin.url as the preferred navigation target when present. Use the typed IDs as fallback routing inputs when the frontend has a different route structure.

On this page