-
Notifications
You must be signed in to change notification settings - Fork 3
Push Notifications
Andre Kless edited this page May 21, 2021
·
13 revisions
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.
Example for POST params to subscribe for push notifications:
{
"sub": {
"endpoint": "...", // unique endpoint identifier
"keys": {
"auth": "...", // authentication secret
"p256dh": "..." // public key
},
"proxy": "...", // proxy URL (default: no proxy)
"db": "mongo|redis", // database name (default: "mongo")
"stores": [
{
"name": "...", // datastore name (MongoDB: collection name)
"observe": {...} // key, keys or query to define observed datasets (MongoDB only, default: all)
}
],
"token": "...", // token of already logged in user (optional)
"realm": "..." // realm of already logged in user (only if a token is passed)
}
}Examples for observe:
"dataset_A"[ "dataset_A", "dataset_B", ... ]{ "key": "value" }[ "dataset_A", { "key": "value" }, ... ]Examples for stores:
"store_A"{
"name": "store_A",
"observe": ...
}[ "store_A", "store_B", ... ][
{
"name": "store_A",
"observe": ...
},
{
"name": "store_B",
"observe": ...
},
...
][
"store_A",
{
"name": "store_B",
"observe": ...
},
...
]