R3 Integration
Cysharp/R3 is a new Rx (Reactive extensions) library that works with Unity and various platforms.
It is the successor to the popular UniRx, with a more modern implementation, a refined API, and an abstraction layer. Check the R3 documentation for more details.
VitalRouter supports integration with R3.
Observable<TCommand> o = publisher.AsObservable<TCommand>() // Convert pub/sub to R3 Observable
// Subscibe and bind publisher.
observable
.Select(x => new FooCommand { X = x }
.SubscribeToPublish(Router.Default);
// Subscibe and bind publisher and await for publishing all. (PublishAsync().Forget())
await observable
.Select(x => new FooCommand { X = x }
.ForEachPublishAndForgetAsync(Router.Default);
// Subscibe and bind publisher and await for publishing all. (await PublishAsync() one by one)
await observable
.Select(x => new FooCommand { X = x }
.ForEachPublishAndAwaitAsync(Router.Default);