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.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user