-
Notifications
You must be signed in to change notification settings - Fork 4
Push Notifications
The ccmjs cloud service for data management on ccm2.inf.h-brs.de supports push notifications. A client-side service worker can subscribe for push notifications. A push notification is triggered when a dataset in the server-side database has changed. The client-side can specify which datasets in which datastores are observed.
{
"sub": {
"subscription": {...}, // subscription object from service worker
"proxy": "...", // proxy URL (default: no proxy)
"db": "mongo|redis", // database name (default: "mongo")
"stores": [
{
"name": "...", // datastore name (MongoDB: collection name)
"observe": {...} // key, keys or simple query to define observed datasets (default: all)
}
],
"token": "...", // token of already logged in user (optional)
"realm": "..." // realm of already logged in user (only if a token is passed)
}
}
"dataset_A"
Observes the dataset with the unique key dataset_A
.
[ "dataset_A", "dataset_B", ... ]
Observes all datasets whose unique key is specified in the array.
{ "key": "value" }
Observes all datasets that have the value value
at property key
. So this is a simple query.
[ "dataset_A", { "key": "value" }, ... ]
An array with a mix of given unique keys and simple queries can also be used.
"store_A"
Observes all datasets in the datastore store_A
.
{
"name": "store_A",
"observe": ...
}
Observes the datasets of the datastore store_A
that are defined in observe
.
[ "store_A", "store_B", ... ]
Observes all datasets of the datastores whose name is specified in the array.
[
{
"name": "store_A",
"observe": ...
},
{
"name": "store_B",
"observe": ...
},
...
]
The array can also contain objects to observe only specific datasets in different datastores.
[
"store_A",
{
"name": "store_B",
"observe": ...
},
...
]
An array with a mix of given datastore names and objects can also be used.