Replies: 3 comments 3 replies
-
Just found out about NeDB, which this article uses for storing web push subscriptions. Is it possible to use Dexie here instead? /ping @dfahlander |
Beta Was this translation helpful? Give feedback.
-
The newly release REST interface can be used from a node app to store key/value items that are kept out from the end users' sync data. It's not exactly covered in the docs how to make the data private for the app, so I'll explain it here (and may copy this text into to the official docs soon). Obtain Authorization for Dexie Cloud REST APIGiven that you have a client ID and secret (found in dexie-cloud.key file that is generated when you create or connect to a DB using {
grant_type: "client_credentials",
scopes: ["ACCESS_DB"],
client_id: <your client ID>,
client_secret: <your client secret>,
claims: {
sub: "[email protected]", // Invent arbritary username for the service account
}
} You'll get back a JSON object with the property "accessToken". Put the content of this in all future requests towards the REST api with header Create a Table (optionally, or use an existing)To add a table that will only be used by the node application, you'll have to sync the dexie schema and add it command line. Make sure to install the latest version of First, export the current schema that dexie cloud is aware of:
Your JSON file will contain something like: {
"schema": {
"members": "@id",
"roles": "[realmId+name]",
"realms": "@realmId"
},
"sealed": false
} Edit that file and add your new table along it's primary key, such as {
"schema": {
"members": "@id",
"roles": "[realmId+name]",
"realms": "@realmId",
"webPushSubscriptions": "id"
},
"sealed": false
} Then use dexie-cloud CLI to import the updated schema:
Put an objectDo a POST request to
When POST:in to the Get an object back from
|
Beta Was this translation helpful? Give feedback.
-
I've also been sketching on how we could have some kind of push-notification feature within dexie-cloud in the future, or at least web hooks that allows a server application to send notifications based on certain mutations in the database. The road map right now is to release the stable version of the service first before introducing that though. |
Beta Was this translation helpful? Give feedback.
-
Is anyone using Dexie Cloud to store the subscriptions of Web Push Notifications?
I'm trying to wrap my head around all the client stuff concerning VAPID keys, subscriptions etc but when it comes to storing the subscriptions on the server people seem to recommend Firebase or FeathersJS – can't we use Dexie in a similar way for this, or am I missing something? Anyone doing this already?
Beta Was this translation helpful? Give feedback.
All reactions