Asset Alert pop-up messages
The assetAlert message format
In addition to synchronization messages, you will also receive assetAlert messages through the socket instead of (or in addition to) regular email and SMS alerts. Simply add the popup UserNotificationMethod to your user's UserNotification.online array.
You do not need to subscribe to the receive the assetAlert messages, they will come through automatically for all assets to which you have access.
assetAlert {
"asset": number, /* uint64 format, see Asset.id */
"body": string, /* see */
"company": number, /* uint64 format, see Company.id */
"delivered": string, /* datetime format, see */
"from": string, /* see */
"id": number, /* uint64 format, see */
"kind": string, /* one of the MemoType values */
"priority": string, /* one of the AlertPriority values */
"processed": string, /* datetime format, see */
"status": string, /* one of the MemoStatus values */
"subject": string, /* see */
"to": string, /* see */
"user": string, /* see User.login */
"v": [
number /* uint32 format, see */
]
}
Online versus offline preferences
Another new concept this feature brings is differentiating between users who are currently connected to the WebSocket, and users who are not. This separation of states allows you to tone down the number of email and SMS notifications a user receives during the day if they are already using the front-end to view their fleet. Simply set the online array to only include the popup UserNotificationMethod and the user will not receive email or SMS notifications while connected. If this is not the desired behaviour, then make the online array include the popup type as well as any other notification methods desired.
The UserNotifications object allows you to define two notification method arrays; online and offline. While a user has a connected WebSocket, the online array is used to generate notifications. If they have multiple WebSocket connections, then an identical assetAlert is sent to each connected socket. If the user has zero current WebSocket connections, then the system uses the offline preferences.
Note: The alert generating system detects your online status based on your WebSocket connection state, and chooses either the online or offline preferences array to create alerts. Because of this, it is possible that alerts generated the moment before you disconnect your WebSocket will not be sent through the socket, but will still be generated using your online preferences.