Files
deepdrft/DeepDrftPublic.Client/Services/IEventPoster.cs
T
daniel-c-harvey 2af0d8650b fix(telemetry): first-party fetch for play/share, beacon only on unload
Route normal play closes (end/switch/stop) and all shares through a same-origin
HttpClient POST so privacy-hardened browsers stop blocking them; keep sendBeacon
for the tab-unload edge. Rename the JS module off telemetry/beacon to session/
lifecycle so the retained fallback isn't name-matched. No new data or identifiers.
2026-06-26 21:11:43 -04:00

20 lines
1.0 KiB
C#

namespace DeepDrftPublic.Client.Services;
/// <summary>
/// The first-party event transport seam (telemetry transport-resilience). Sends a serialized event body
/// to a same-origin <c>api/event/*</c> route over <see cref="System.Net.Http.HttpClient"/> — a fetch to
/// the site's own host proxy, which privacy / tracking heuristics do not block the way they name-match a
/// <c>sendBeacon</c> module. Abstracted so the play sink and the share tracker share one best-effort,
/// non-throwing POST, and so tests can capture the wire payload behind a fake with no HTTP — the same
/// one-seam pattern as <see cref="IPlayEventSink"/>.
/// </summary>
public interface IEventPoster
{
/// <summary>
/// Best-effort POST of <paramref name="json"/> (an <c>application/json</c> body) to
/// <paramref name="url"/>. Never throws: a failed POST is swallowed so telemetry cannot break the UI
/// or the playback path. Awaitable, but safe to fire-and-forget on a live page.
/// </summary>
Task PostAsync(string url, string json);
}