Overview
Thresh is a low-level infrastructure library for League Client API integration.
It provides composable transport, discovery, and event primitives. It does not provide high-level application orchestration.
Core API surfaces
Thresh exposes two primary abstractions designed to work together:
ILcuHttpClientfor resilient HTTP interactionsIEventStreamfor real-time WAMP events (OnJsonApiEvent)
Package map
Thresh.Extensions— DI registration and core runtime compositionThresh.Endpoints— optional typed endpoint groups overILcuHttpClientThresh.Hosting— hosting/lifecycle integration for background processesThresh.HealthChecks— health check integrationThresh.Reactive— optional reactive wrappers around event streams
Start with Thresh.Extensions, then add optional packages only where needed.
Architecture at a glance
- Public abstractions:
Thresh.Abstractions - Runtime implementation:
Thresh.Core - DI integration:
Thresh.Extensions
This separation keeps business logic independent from transport internals and improves testability.
Design principles
- async-first APIs with
CancellationTokensupport - DI-first composition
- resilience defaults via Polly v8 retry and circuit-breaker strategies
- observability hooks via
ILogger,Meter, andActivitySource("Thresh") - strict local trust model for authenticated LCU communication
Event model
IEventStream manages connection lifecycle and reconnection, and emits:
RawMessagefor raw WAMP payloadsMessagefor parsedLeagueEventEnvelopevaluesReconnectedwhen a connection is re-established
Subscriptions are available by:
- exact URI (
Subscribe(string uri, ...)) - regex pattern (
Subscribe(Regex pattern, ...)) - typed payload (
Subscribe<T>(..., withSnapshot: true|false))
Platform and discovery model
- Official support targets Windows and macOS.
- Other environments (including Linux/Wine/Proton variants) are best-effort.
- Use
LCU_LOCKFILEexplicitly for non-standard layouts.
Lockfile resolution is deterministic:
LCU_LOCKFILEoverride- cached lockfile path (if valid)
- process-derived candidates
- known install paths per platform
Boundary reminder
Thresh stays intentionally focused on reliable primitives.
Higher-level workflows, state machines, and domain orchestration should live in consumer code or optional packages.