crdt_sync 1.0.4 copy "crdt_sync: ^1.0.4" to clipboard
crdt_sync: ^1.0.4 copied to clipboard

A dart-native turnkey solution for painless network synchronization

crdt_sync #

A Dart-native turnkey solution for painless network synchronization.

crdt_sync takes care of the network plumbing between your app and backend to build products that are:

  • Offline-first: Apps primarily work with a local store independent of network connectivity.
  • Real-time: When online, the local store immediately and continuously synchronizes with the backend.
  • Efficient: Synchronization relies on delta changesets to optimize the amount of data sent over the wire.
  • Portable: All communication happens over a single standard WebSocket making it compatible with most network configurations.

This library is compatible with the crdt package and all of its implementations. It uses a standard communication protocol which abstracts the underlying storage method. This results in the dubious ability to synchronize SQL nodes with No-SQL ones. I don't judge.

See crdt for more details and a list of existing implementations.

Usage #

You'll most likely want to use a persistent crdt store, however the following sample code uses an ephemeral MapCrdt for the sake of simplicity:

final crdt = MapCrdt(['chat']);

Server #

Start listening for connections:

listen(crdt, 8080);

Alternatively, you can use upgrade() to adopt an HttpRequest, or CrdtSync.server() to manage a WebSocket directly making it easy to integrate with Shelf and other server frameworks.

See tudo_server for a real world example.

Client #

Instantiate a CrdtSyncClient and order it to start connecting:

final client = CrdtSyncClient(crdt, Uri.parse('ws://localhost:8080'));
client.connect();

Once connect() is called, the client will continuously attempt to establish or resume a connection until it succeeds, or until disconnect() is called.

See the included example for a more complete solution, or tudo for a real-world application.

Features and bugs #

Please file feature requests and bugs in the issue tracker.

10
likes
0
pub points
64%
popularity

Publisher

verified publishercachapa.net

A dart-native turnkey solution for painless network synchronization

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

crdt, web_socket_channel

More

Packages that depend on crdt_sync