Skip to content

How P2PSDK works

P2PSDK is a native network runtime exposed through platform wrappers. The wrapper translates platform lifecycle and consent decisions into a stable SDK instance while keeping transport policy outside application code.

Your application ownsThe SDK owns
Where the feature is offeredNative runtime and handle lifetime inside the wrapper
Reward presentation and business eligibilityConsent result verification and local decision storage
Holding one instance for the required lifetimeDevice identity derivation and persistence fallback
Responding to connected/disconnected eventsConnection attempts, reconnect, battery, and DNS policy
User-facing revoke entry pointPosting revoke and closing after success
Sanitized telemetryNative error mapping and platform callback dispatch

SDK runtime sequence

From consent to a connected peer.

Lifecycle
CONSENT P2PSDK RELEASEOne owned instance
  1. 02 / InstanceCreateOne owner per peer
  2. 03 / SupervisorConnectStart connection setup
  3. 04 / NetworkOnlineConnected event fires
  4. 05 / ReleaseCloseRelease exactly once
Consent gateBefore create
Online signalConnected event
Final releaseExactly once

A successful connect call starts the supervisor. Wait for the connected event before treating the peer as online.

After connect() starts the supervisor, the SDK performs its control-plane and transport setup. Only the connected event marks the peer online. If connectivity or policy interrupts the owner connection, the SDK reports a reason and applies its assigned reconnect behavior.

Application code does not select connection endpoints, runtime bearer tokens, reconnect delays, DNS servers, battery thresholds, or protocol features. These are controlled by the SDK and its authenticated runtime policy.

The owner connection can accept independent network streams after the SDK is online. Stream parsing, bounded buffers, target failures, and cancellation remain internal. An application should not attempt to inspect or route individual streams through wrapper APIs.

A malformed or failed stream should not terminate unrelated streams. A failed owner connection moves the SDK offline, emits a disconnected reason, and can be retried by the internal supervisor. Callback failures are contained by supported wrappers so they do not cross native runtime boundaries.