platform/packages/sync/README.md

21 lines
1.1 KiB
Markdown
Raw Normal View History

# Protevus Sync
2017-08-08 21:04:36 +00:00
[![version](https://img.shields.io/badge/pub-v4.1.1-brightgreen)](https://pub.dev/packages/protevus_sync)
2021-08-20 04:59:02 +00:00
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
2024-07-07 15:02:49 +00:00
[![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM)
[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/protevus/tree/protevus/packages/sync/LICENSE)
2017-08-08 21:04:36 +00:00
2021-09-12 04:33:41 +00:00
Easily synchronize and scale WebSockets using [belatuk_pub_sub](<https://pub.dev/packages/belatuk_pub_sub>).
2021-08-20 04:59:02 +00:00
## Usage
This package exposes `PubSubSynchronizationChannel`, which can simply be dropped into any `AngelWebSocket` constructor. Once you've set that up, instances of your application will automatically fire events in-sync. That's all you have to do to scale a real-time application with Protevus!
2017-08-08 21:04:36 +00:00
```dart
2021-08-20 04:59:02 +00:00
await app.configure(AngelWebSocket(
2021-09-12 02:52:19 +00:00
synchronizationChannel: PubSubSynchronizationChannel(
2021-08-20 04:59:02 +00:00
pub_sub.IsolateClient('<client-id>', adapter.receivePort.sendPort),
2017-08-08 21:04:36 +00:00
),
));
2021-08-20 04:59:02 +00:00
```