YDotNet 0.2.10

There is a newer version of this package available.
See the version list below for details.
dotnet add package YDotNet --version 0.2.10                
NuGet\Install-Package YDotNet -Version 0.2.10                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YDotNet" Version="0.2.10" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YDotNet --version 0.2.10                
#r "nuget: YDotNet, 0.2.10"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install YDotNet as a Cake Addin
#addin nuget:?package=YDotNet&version=0.2.10

// Install YDotNet as a Cake Tool
#tool nuget:?package=YDotNet&version=0.2.10                

YDotNet

YDotNet is a .NET binding for y-crdt. It provides distributed data types that enable real-time collaboration between devices. The library is a thin wrapper around Yrs, taking advantage of the safety and performance of Rust.

💡 Disclaimer: this project is still early, so it may contain bugs and the API is subject to change. Feel free to open an issue if you'd like to report problems or suggest new features.

Installation

This section is a WIP, the project has not yet been published to NuGet.

Getting Started

YDotNet provides the same shared data types as Yjs. All objects are shared within a Doc and always get modified within the scope of a Transaction.

// Set up the local document with some sample data.
var localDoc = new Doc();
var localText = localDoc.Text("name");

var localTransaction = localDoc.WriteTransaction();
localText.Insert(localTransaction, 0, "Y-CRDT");
localTransaction.Commit();

// Set up the remote document.
var remoteDoc = new Doc();
var remoteText = remoteDoc.Text("name");

// Get the remote document state vector.
var remoteTransaction = remoteDoc.WriteTransaction();
var remoteState = remoteTransaction.StateVectorV1();

// Calculate the state diff between the local and the remote document.
localTransaction = localDoc.ReadTransaction();
var stateDiff = localTransaction.StateDiffV1(remoteState);
localTransaction.Commit();

// Apply the state diff to synchronize the remote document with the local changes.
var result = remoteTransaction.ApplyV1(stateDiff);

// Read the text from the remote document.
var text = remoteText.String(remoteTransaction);

// At this point, the `text` variable is "Y-CRDT" and this demonstrates how the two
// documents synchronized their state.
//
// This example does it locally but the same could be done over the Internet, for example.

Development Setup

This section is a WIP, but you should be able to run the project through the unit tests after building a dynamic library for your operating system by adding cdylib to the crate-type in the Cargo.toml file of the yffi` library.

Tests

All tests are located in the YDotNet.Tests.Unit project and should be easily runnable using the command:

dotnet test
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on YDotNet:

Package Downloads
YDotNet.Server

YDotNet provides cross-platform .NET bindings for Yrs (Rust port of Yjs).

YDotNet.Server.WebSockets

YDotNet provides cross-platform .NET bindings for Yrs (Rust port of Yjs).

YDotNet.Extensions

YDotNet provides cross-platform .NET bindings for Yrs (Rust port of Yjs).

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on YDotNet:

Repository Stars
Squidex/squidex
Headless CMS and Content Managment Hub
Version Downloads Last updated
0.4.1 1,863 7/24/2024
0.4.0 2,209 4/16/2024
0.3.0 990 2/28/2024
0.2.13 360 2/12/2024
0.2.12 243 12/3/2023
0.2.11 199 11/16/2023
0.2.10 198 11/14/2023
0.2.9 230 10/30/2023
0.2.4 210 10/17/2023