@devskin/browser-sdk 1.0.47 → 1.0.48

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.
@@ -13627,37 +13627,21 @@
13627
13627
  }
13628
13628
  sendRecordingEvents(sessionId, events) {
13629
13629
  return __awaiter$1(this, void 0, void 0, function* () {
13630
- // Calculate payload size
13631
- const payload = {
13632
- session_id: sessionId,
13633
- events,
13634
- timestamp: new Date().toISOString(),
13635
- apiKey: this.config.apiKey,
13636
- appId: this.config.appId,
13637
- };
13638
- const payloadSize = new Blob([JSON.stringify(payload)]).size;
13639
13630
  // Check if this batch contains FullSnapshot (type 2)
13640
13631
  const hasFullSnapshot = events.some(e => e.type === 2);
13641
- const maxRetries = hasFullSnapshot ? 3 : 1; // Retry FullSnapshot batches up to 3 times
13642
- // Recording events can be large, send immediately with retry logic
13632
+ const maxRetries = hasFullSnapshot ? 3 : 1;
13633
+ // ALWAYS use XHR for recording events to avoid fetch keepalive 64KB limit
13634
+ // The browser silently drops fetch requests with keepalive:true when body > 64KB
13635
+ // FullSnapshot + Meta events commonly fall in the 64KB-100KB range,
13636
+ // causing them to be silently lost while smaller IncrementalSnapshot batches succeed
13643
13637
  let lastError = null;
13644
13638
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
13645
13639
  try {
13646
- // Use XMLHttpRequest for large payloads (more reliable than fetch for large data)
13647
- if (payloadSize > 100000) { // > 100KB
13648
- yield this.sendToBackendXHR('/v1/rum/recordings', {
13649
- session_id: sessionId,
13650
- events,
13651
- timestamp: new Date().toISOString(),
13652
- });
13653
- }
13654
- else {
13655
- yield this.sendToBackend('/v1/rum/recordings', {
13656
- session_id: sessionId,
13657
- events,
13658
- timestamp: new Date().toISOString(),
13659
- });
13660
- }
13640
+ yield this.sendToBackendXHR('/v1/rum/recordings', {
13641
+ session_id: sessionId,
13642
+ events,
13643
+ timestamp: new Date().toISOString(),
13644
+ });
13661
13645
  return; // Success, exit
13662
13646
  }
13663
13647
  catch (error) {