2017-08-08 20:08:37 +00:00
|
|
|
# sync
|
2017-08-08 21:04:36 +00:00
|
|
|
[](https://pub.dartlang.org/packages/angel_sync)
|
|
|
|
[](https://travis-ci.org/angel-dart/sync)
|
|
|
|
|
2017-08-08 20:08:37 +00:00
|
|
|
Easily synchronize and scale WebSockets using package:pub_sub.
|
2017-08-08 21:04:36 +00:00
|
|
|
|
|
|
|
# Usage
|
2018-11-15 17:42:41 +00:00
|
|
|
This package exposes `PubSubSynchronizationChannel`, which
|
2017-08-08 21:04:36 +00:00
|
|
|
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 Angel!
|
|
|
|
|
|
|
|
```dart
|
|
|
|
await app.configure(new AngelWebSocket(
|
2018-11-15 17:42:41 +00:00
|
|
|
synchronizationChannel: new PubSubSynchronizationChannel(
|
2017-08-08 21:04:36 +00:00
|
|
|
new pub_sub.IsolateClient('<client-id>', adapter.receivePort.sendPort),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
```
|