platform/packages/sync/README.md

24 lines
1.1 KiB
Markdown
Raw Normal View History

2021-08-20 04:59:02 +00:00
# Angel3 Sync
2017-08-08 21:04:36 +00:00
2021-09-12 04:33:41 +00:00
[![version](https://img.shields.io/badge/pub-v4.1.1-brightgreen)](https://pub.dev/packages/angel3_sync)
2021-08-20 04:59:02 +00:00
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
2021-09-12 04:08:37 +00:00
[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dukefirehawk/angel/tree/angel3/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
2021-09-12 02:52:19 +00:00
to scale a real-time application with Angel3!
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
```