@monoscopetech/browser 0.5.9 → 0.6.0
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/dist/replay.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getRecordConsolePlugin } from "@rrweb/rrweb-plugin-console-record";
|
|
2
2
|
import * as rrweb from "rrweb";
|
|
3
3
|
const MAX_EVENT_BATCH = 50;
|
|
4
|
-
const SAVE_INTERVAL =
|
|
5
|
-
const MAX_RETRY_EVENTS =
|
|
4
|
+
const SAVE_INTERVAL = 2000;
|
|
5
|
+
const MAX_RETRY_EVENTS = 5000;
|
|
6
6
|
export class MonoscopeReplay {
|
|
7
7
|
constructor(config, sessionId) {
|
|
8
8
|
this.events = [];
|
|
@@ -141,14 +141,16 @@ export class MonoscopeReplay {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
|
-
//
|
|
144
|
+
// Use keepalive so the request survives page navigation,
|
|
145
|
+
// but only when payload fits under the 64KB keepalive limit
|
|
146
|
+
const body = JSON.stringify(payload);
|
|
145
147
|
const response = await fetch(baseUrl, {
|
|
146
148
|
method: "POST",
|
|
147
149
|
headers: {
|
|
148
150
|
"Content-Type": "application/json",
|
|
149
151
|
},
|
|
150
|
-
body
|
|
151
|
-
keepalive:
|
|
152
|
+
body,
|
|
153
|
+
keepalive: body.length < 63000,
|
|
152
154
|
});
|
|
153
155
|
if (!response.ok) {
|
|
154
156
|
throw new Error(`Failed to save replay events: ${response.status} ${response.statusText}`);
|