Table of Contents

Method DisconnectAndClear

Namespace
PowerSync.Common.Client
Assembly
PowerSync.Common.dll

DisconnectAndClear(bool, bool)

Disconnect and clear the database. Use this when logging out. The database can still be queried after this is called, but the tables would be empty.

To preserve data in local-only tables, set clearLocal to false.

A "soft" clear deletes publicly visible tables, but keeps internal copies of data synced in the database. This usually means that if Connect(IPowerSyncBackendConnector, PowerSyncConnectionOptions?) is later called again with a JWT from the same user, the first sync is very fast because all internal data is still available. When a different user logs in, no old data would be visible at any point. Using soft deletes is recommended where it's not a security issue that old data could be reconstructed from internal database tables.

public Task DisconnectAndClear(bool clearLocal = true, bool soft = false)

Parameters

clearLocal bool
soft bool

Returns

Task