Quickstart
This guide walks through package selection, DI registration, first HTTP call, and event subscription.
1) Choose packages
Start with Thresh.Extensions.
Add optional packages only when needed:
Thresh.Endpointsfor typed endpoint groupsThresh.Hostingfor hosted/background process integrationThresh.HealthChecksfor readiness/liveness checksThresh.Reactivefor reactive composition
For detailed guidance, see Package guidance.
2) Install
dotnet add package Thresh.Extensions
3) Register services
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Thresh.Abstractions;
using Thresh.Extensions;
var services = new ServiceCollection()
.AddLogging(b => b.AddSimpleConsole())
.AddThresh(o =>
{
o.AcceptSelfSignedCertificates = true; // LCU HTTP (loopback only)
o.WsAcceptSelfSignedCertificates = true; // LCU WebSocket (loopback only)
});
await using var provider = services.BuildServiceProvider();
4) Resolve clients
var api = provider.GetRequiredService<ILcuHttpClient>();
var ws = provider.GetRequiredService<IEventStream>();
5) Connect the event stream
await ws.ConnectAsync();
var connected = await ws.WaitUntilConnectedAsync(TimeSpan.FromSeconds(3));
if (!connected)
{
Console.WriteLine("WebSocket connection timeout.");
}
6) Subscribe to typed events (with snapshot)
using var sub = ws.Subscribe<System.Text.Json.JsonElement>("/lol-gameflow/v1/session", data =>
{
var phase = data.TryGetProperty("phase", out var p) ? p.GetString() : "?";
Console.WriteLine($"Gameflow phase = {phase}");
}, withSnapshot: true);
7) Perform a REST call
var me = await api.GetAsync<System.Text.Json.JsonElement>("/lol-summoner/v1/current-summoner");
Console.WriteLine(me?.GetProperty("displayName").GetString());
Prerequisites
- Official runtime support is Windows and macOS.
- Other environments (including Linux/Wine/Proton variants) are best-effort.
- League Client must be running, or
LCU_LOCKFILEmust point to a valid lockfile path.
Lockfile discovery order:
LCU_LOCKFILEenvironment override- cached lockfile path (if valid)
- process-derived candidates
- known install paths per platform
Notes
IEventStreamimplementsIAsyncDisposable; preferawait usingwhere relevant.- For local development, self-signed certificate options remain loopback scoped.
- Prefer relative LCU paths to use lockfile-derived rebasing and safe auth destination checks.
Build local docs (DocFX)
dotnet tool update -g docfx
docfx docs/docfx.json --serve
Open http://localhost:8080.
The docs.yml workflow publishes docs/_site to GitHub Pages.