Skip to content

Conversation

@stevensJourney
Copy link
Contributor

This is the Dart port of

powersync-ja/powersync-js#783

This allows clients to specify application metadata when calling powerSync.connect. This Record of String values is logged in the PowerSync service logs, which can be used for debugging and analytics. For context: powersync-ja/powersync-service#413

  db.connect(
      connector: currentConnector,
      options: SyncOptions(
          syncImplementation: SyncClientImplementation.rust,
          appMetadata: {'app_version': '1.0.1'}));
}

@stevensJourney stevensJourney marked this pull request as ready for review December 10, 2025 10:20
Copy link
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API changes and native implementation look good to me. On the web, we would also have to serialize appMetadata so that it reaches the sync worker.

The StartSynchronization extension type in sync_worker_protocol is the relevant message for that, I think serializing to JSON might be the simplest approach which is also what we do for the schema and sync parameters.

In the worker, we'd have to pass this through _ConnectedClient -> referenceSyncTask -> _AddConnection -> _SyncRunner future (what a quest, I should probably look into simplifying that at some point).

@stevensJourney
Copy link
Contributor Author

Added support for web. Verified the metadata is passed through on web.
image

Copy link
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@stevensJourney stevensJourney merged commit 8188bb9 into main Dec 12, 2025
5 checks passed
@simolus3 simolus3 deleted the app-metadata branch December 12, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants