SignalR API
The SignalR API can be reached by connecting to the URL “/hubs/notification” passing a valid DFS JSON Web Token (JWT). A JavaScript client A client is a piece of software that requests tokens from IdentityServer - either for authenticating a user (requesting an identity token) or for accessing a resource (requesting an access token). A client must be first registered with IdentityServer before it can request tokens. Examples for clients are web applications, native mobile or desktop applications, SPAs, server processes, etc. library can be found here: @aspnet/signalr, A sample implementation interacting with the API via JavaScript can be found in the files “src\additiv.NotificationHub.Server\wwwroot\js\test.js” and “src\additiv.NotificationHub.Server\Pages\Test.cshtml” contained in the solution mentioned in the introduction section.
ReceiveNotification
This method is called by the server on the client to inform it about a new notification. The output looks as follows:
Class Name: | Notification | |
Name | Mandatory | Description |
Id | Y | The ID of the notification. |
IsRead | Y | Indicates if the notification is marked as read. |
Subject | Y | The subject text of the notification. |
Text | Y | The body text of the notification. |
GetNotification
This method can be called by a client to get an existing notification by ID. The input looks as follows:
Name | Mandatory | Description |
Notificationid | Y | The ID of the notification. |
, and the output as follows:
Class Name: | Notification |
Name | Description |
Id | The ID of the notification. |
IsRead | Indicates if the notification is marked as read. |
Subject | The subject text of the notification. |
Text | The body text of the notification. |
GetNotifications
This method can be called by a client to get existing notifications. The input looks as follows:
Class Name: | GetNotificationsRequest | |
Name | Mandatory | Description |
IsRead | N | Indicates if only read (true), unread (false) or all notifications (null) should be returned. |
, and the output as follows:
Class Name: |
GetNotificationsResult GetNotificationsResult.Notifications |
Name | Description |
Id | The ID of the notification. |
IsRead | Indicates if the notification is marked as read. |
Subject | The subject text of the notification. |
Text | The body text of the notification. |
MarkNotificationAsRead
This method can be called by a client to mark an existing notification as read. The nput looks as follows:
Name | Mandatory | Description |
Notificationid | Y | The ID of the notification. |
MarkNotificationsAsRead
This method can be called by a client to mark all unread notifications as read.