@oneuptime/react-native-replay 14.0.1 → 14.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -232,6 +232,57 @@ The SDK never sets a browser `Origin` header. It sends
232
232
  `x-oneuptime-replay-recorder-kind: rn-view-tree` and the mobile app identifier;
233
233
  the server validates the identifier and synthesizes its exact `app://` origin.
234
234
 
235
+ ## Offline mode
236
+
237
+ Recording never depends on the network. An app that loses its connection
238
+ keeps recording into the outbox and uploads the whole backlog, in order, when
239
+ the connection returns; an app killed while offline uploads it on its next
240
+ launch.
241
+
242
+ - **An outage costs a chunk nothing.** A request that never reaches the
243
+ server (no connection, or a 10 s timeout) keeps the chunk without spending
244
+ one of its three attempts, and is retried after 5 s, 15 s, 30 s and then
245
+ every minute for as long as the outage lasts. A throttle (`429`, or any
246
+ answer carrying `Retry-After`) is waited out the same way. Only a server
247
+ that answers with an error spends attempts. New chunks are stored, not
248
+ posted, while a retry is pending.
249
+ - **The outbox survives long outages.** Each chunk is stored gzip-compressed
250
+ under its own AsyncStorage key (Android cannot read back a value larger
251
+ than 2 MB, so the earlier single-key outbox lost everything once a backlog
252
+ outgrew that). It holds up to 240 chunks and 3 MB of compressed data - an
253
+ hour or more of recording - and evicts the oldest past either bound. A
254
+ queue written by an earlier SDK version is migrated on first use.
255
+ - **An app launched offline still records.** The last policy the server gave
256
+ is remembered (per host, application and ingestion key) and used when the
257
+ config request gets no answer - never when the server answers that replay
258
+ is off, which deletes it. It is never older than three days, never a
259
+ "targeted" capture, never written before a required consent, and is
260
+ forgotten when consent is withdrawn. The policy is fetched fresh as soon as
261
+ the connection is back.
262
+ - **Uploads resume by themselves.** Returning to the foreground retries the
263
+ backlog at once. Pass a connectivity source to stop every attempt while the
264
+ device reports it is offline and to upload the instant it reports it is
265
+ back - with `@react-native-community/netinfo`:
266
+
267
+ ```tsx
268
+ import NetInfo from "@react-native-community/netinfo";
269
+
270
+ OneUptimeReplay.start({
271
+ // host, token, appIdentifier, mobileAppIdentifier...
272
+ connectivity: {
273
+ subscribe: (listener) =>
274
+ NetInfo.addEventListener((state) => listener(state.isConnected)),
275
+ },
276
+ });
277
+ ```
278
+
279
+ - **The timeline stays true.** Each chunk's `clientSendUnixMs` is stamped when
280
+ it is actually sent, so the server knows how long it waited (up to the
281
+ three-day offline delay) and places the recording where it happened.
282
+ - Diagnostics report `chunk-network-failure`, `back-online`,
283
+ `network-offline` / `network-online`, `config-from-cache` and
284
+ `outbox-overflow`.
285
+
235
286
  ## Fidelity limitations
236
287
 
237
288
  - Reanimated/UI-thread animations are sampled, not frame-accurate.