What I learned building an xAPI 2.0 library and LRS for .NET
Описание и применение
xapi-dotnet – современная библиотека .NET для xAPI 2.0 и LRS, полностью совместимая с ADL, с устойчивым outbox‑ом и поддержкой Unity/WebGL.
Задача
Existing .NET xAPI libraries lack xAPI 2.0 support and have performance and reliability issues.
Результат
xapi-dotnet now fully supports xAPI 2.0, passes all ADL conformance tests, offers durable outbox, and runs in Unity/WebGL. It improves JSON parsing performance by ~60% and reduces memory allocation.
Рабочий процесс
- 1. Implement statement models and validation for xAPI 2.0.
- 2. Build async client with durable disk‑based outbox.
- 3. Embed LRS in ASP.NET Core with EF Core on SQLite/PostgreSQL.
- 4. Integrate ADL conformance suite in CI, parsing JSON log to enforce test floor.
- 5. Optimize JSON parsing performance and validation error reporting.
- 6. Add Unity support, including WebGL handler and async file read adjustments.
- 7. Publish NuGet package and Docker image, provide migration guide from TinCan.NET.
Доказательства
TinCan.NET last changed in 2018. It targets net35, its calls block, and it has no xAPI 2.0 support.
The LRS now passes all 1,365 and all 1,435 tests, on both databases, in four CI jobs on every pull request.
Reading the same statement takes 5.48 μs and 5.2 KB, about four times the cost of JsonDocument.Parse over the same bytes.
The file store flushes its journal to disk before EnqueueAsync returns, and that turned out to be almost all of the cost: 4.7 ms per enqueue on my M1 Pro.
- Дата записи: 2026-10-17T18:56:13.142Z