Skip to content

Conversation

@Chriztiaan
Copy link
Collaborator

@Chriztiaan Chriztiaan commented Jan 20, 2026

Added support for sync streams, based on reference implementations from other SDKs.

Minor changes were made to the API to support mocking of the remote, this allows new possibilities with mocking the backend when testing.

Copy link

@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.

Thanks for taking a look at sync streams 🚀 I have a few high-level / API design comments from a quick look, but please treat them as optional since I'm not that familiar with the dotnet SDK.

@Chriztiaan Chriztiaan marked this pull request as ready for review January 27, 2026 11:48
@Chriztiaan Chriztiaan requested a review from LucDeCaf January 27, 2026 11:48
@Chriztiaan Chriztiaan changed the title Feat/sync streams (feat) Sync Streams Jan 27, 2026
@Chriztiaan Chriztiaan changed the title (feat) Sync Streams (feat): Sync Streams Jan 27, 2026
Copy link

@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.

This looks good to me from a high-level perspective (since I don't know C# that much).

Comment on lines +34 to +35
[JsonProperty("streams")]
public object[]? Streams { get; set; } = [];

Choose a reason for hiding this comment

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

Out of interest, why did this have to be added here? Since we're using the Rust client, I'm kind of surprised we need these protocol message types at all.

If they're only used for mock tests, maybe we should move them to test sources (but it probably makes sense to do that in a separate PR).

Copy link
Collaborator Author

@Chriztiaan Chriztiaan Jan 28, 2026

Choose a reason for hiding this comment

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

Yes this just made some of the testing easier, and yes - open to moving it in the future.

Copy link
Contributor

@LucDeCaf LucDeCaf left a comment

Choose a reason for hiding this comment

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

Happy overall, might be able to improve the user-facing API a little bit.

public interface IPowerSyncDatabase : IEventStream<PowerSyncDBEvent>
{
public Task Connect(IPowerSyncBackendConnector connector, PowerSyncConnectionOptions? options = null);
public ISyncStream SyncStream(string name, Dictionary<string, object>? parameters = null);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be nice for users if they could pass an anonymous object which is serialised later. Something like this:

powerSync.SyncStream("stream", new { foo: "a" }).Subscribe();

It would also be nice for the SDK to support the Dictionary<string, object> syntax so that users can build up a list of parameters iteratively, so if we support new { ... } we shouldn't drop support for new Dictionary<string, object>() { ... }. I think both Newtonsoft.Json and System.Text.Json handle both cases just fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree, we can update this alongside client params in a follow up.

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.

4 participants