Client Options
DB options
These options define your local cache.
migrations
is a list of migrations to run on the local cache (which will define a schema, see Schema)schema
is a hard coded schema for your local cachestorage
determines the storage engines for your local cache (see Storage)
Sync options
These options define how you want to sync with the server.
serverUrl
is the url of the server where your project lives e.g.https://<project-id>.triplit.io
The serverUrl
can be updated with the client.updateServerUrl
method.
Auth options
These options define how you authenticate with your client database and remote database.
token
is a jwt that is used to identify the user to the client database and remote databases (see the Auth guide). Providing atoken
will set the variable$SESSION_USER_ID
on the database, which is used for authorization rules.claimsPath
is the path to the Triplit claims on the token. It should be a.
separated string likepath.to.claims
. This should match the value set on your project in the Triplit Dashboard.
The token
can be updated with the client.updateToken
method.
Use the client.updateOptions
method if you need to update the serverUrl
and token
atomically.
Using client.updateOptions
, client.updateServerUrl
or client.updateOptions
will result in the client closing its existing Websocket connection and attempting to open a new one with the provided URL/token.