Reactive usage
Thresh.Reactive is an optional layer for teams that prefer reactive composition over callback-only subscriptions.
When to use it
- You need stream transforms (
Select,Where, buffering) - You combine multiple event streams
- You centralize event processing pipelines
Baseline pattern
Use IEventStream as transport, then project events into the reactive model used by your application.
await ws.ConnectAsync();
await ws.WaitUntilConnectedAsync(TimeSpan.FromSeconds(3));
using var sub = ws.Subscribe<System.Text.Json.JsonElement>("/lol-gameflow/v1/session", evt =>
{
// Bridge this callback into your reactive pipeline.
});
Operational notes
- Keep cancellation ownership explicit.
- Handle reconnection as a normal runtime condition.
- Avoid heavy work on subscription callbacks; queue to worker pipelines when needed.