react-websocket 4.22.1 → 4.22.3

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.
Files changed (60) hide show
  1. package/dist/ag-ui.cjs +8 -9
  2. package/dist/ag-ui.cjs.map +1 -1
  3. package/dist/ag-ui.d.cts +3 -8
  4. package/dist/ag-ui.d.ts +0 -2
  5. package/dist/ag-ui.js +8 -9
  6. package/dist/ag-ui.js.map +1 -1
  7. package/dist/chaos.cjs +60 -13
  8. package/dist/chaos.cjs.map +1 -1
  9. package/dist/chaos.d.cts +1 -2
  10. package/dist/chaos.d.ts +1 -2
  11. package/dist/chaos.js +60 -13
  12. package/dist/chaos.js.map +1 -1
  13. package/dist/core.cjs +93 -65
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.d.cts +4 -25
  16. package/dist/core.d.ts +4 -25
  17. package/dist/core.js +93 -65
  18. package/dist/core.js.map +1 -1
  19. package/dist/devtools.cjs +1 -2
  20. package/dist/devtools.d.cts +0 -2
  21. package/dist/devtools.d.ts +0 -2
  22. package/dist/devtools.js +1 -2
  23. package/dist/index.cjs +1 -2
  24. package/dist/index.d.cts +4 -31
  25. package/dist/index.d.ts +3 -24
  26. package/dist/index.development.cjs +1 -2
  27. package/dist/index.development.js +1 -2
  28. package/dist/index.js +1 -2
  29. package/dist/outbox.cjs +15 -10
  30. package/dist/outbox.cjs.map +1 -1
  31. package/dist/outbox.d.cts +1 -3
  32. package/dist/outbox.d.ts +0 -2
  33. package/dist/outbox.js +15 -10
  34. package/dist/outbox.js.map +1 -1
  35. package/dist/replay.cjs +13 -9
  36. package/dist/replay.cjs.map +1 -1
  37. package/dist/replay.d.cts +8 -4
  38. package/dist/replay.d.ts +8 -4
  39. package/dist/replay.js +13 -9
  40. package/dist/replay.js.map +1 -1
  41. package/dist/tabs.cjs +12 -16
  42. package/dist/tabs.cjs.map +1 -1
  43. package/dist/tabs.d.cts +0 -2
  44. package/dist/tabs.d.ts +0 -2
  45. package/dist/tabs.js +12 -16
  46. package/dist/tabs.js.map +1 -1
  47. package/dist/timeline.cjs +4 -3
  48. package/dist/timeline.cjs.map +1 -1
  49. package/dist/timeline.d.cts +3 -7
  50. package/dist/timeline.d.ts +2 -4
  51. package/dist/timeline.js +4 -3
  52. package/dist/timeline.js.map +1 -1
  53. package/dist/{types-paLT8yQF.d.cts → types-DyZm2F7B.d.cts} +4 -5
  54. package/dist/webtransport.cjs +13 -12
  55. package/dist/webtransport.cjs.map +1 -1
  56. package/dist/webtransport.d.cts +0 -2
  57. package/dist/webtransport.d.ts +0 -2
  58. package/dist/webtransport.js +13 -12
  59. package/dist/webtransport.js.map +1 -1
  60. package/package.json +9 -9
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/types.ts
1
+ // src/types.ts
2
2
  /**
3
3
  * Reported via the `error` event (and `onError`) when an incoming message can't be
4
4
  * decoded by `parse`/`json` or fails `schema` validation. The message is not delivered.
@@ -22,8 +22,7 @@ var MessageError = class extends Error {
22
22
  this.issues = options?.issues;
23
23
  }
24
24
  };
25
- //#endregion
26
- //#region src/client.ts
25
+ // src/client.ts
27
26
  const OPEN = 1;
28
27
  const RECONNECT_DEFAULTS = {
29
28
  maxAttempts: Infinity,
@@ -34,7 +33,7 @@ const RECONNECT_DEFAULTS = {
34
33
  minUptime: 5e3
35
34
  };
36
35
  const QUEUE_LIMIT = 100;
37
- const MAX_TIMEOUT = 2 ** 31 - 1;
36
+ const MAX_TIMEOUT$2 = 2 ** 31 - 1;
38
37
  /**
39
38
  * The default `reconnect.shouldReconnect`: retry every close except `1002` (protocol error),
40
39
  * `1003` (unsupported data) and `1008` (policy violation, often a rejected login), which
@@ -113,8 +112,11 @@ function isThenable(value) {
113
112
  const ON_TEARDOWN = Symbol.for("react-websocket.onTeardown");
114
113
  /** @internal Method key on a socket that sends `volatile` messages as datagrams (WebTransport). */
115
114
  const DATAGRAM = Symbol.for("react-websocket.datagram");
116
- /** @internal Method key for what `react-websocket/devtools` shows that the snapshot doesn't. */
117
- const INSPECT = Symbol.for("react-websocket.inspect");
115
+ /**
116
+ * @internal Method key for what `react-websocket/devtools` shows that the snapshot doesn't. Requests
117
+ * read its queue length too, to tell a dropped message from a queued one.
118
+ */
119
+ const INSPECT$1 = Symbol.for("react-websocket.inspect");
118
120
  function createClient(url, options = {}) {
119
121
  const onTeardown = options[ON_TEARDOWN];
120
122
  const log = options.logger ?? (() => {});
@@ -144,6 +146,7 @@ function createClient(url, options = {}) {
144
146
  let wanted = false;
145
147
  let refs = 0;
146
148
  let pinned = false;
149
+ let unpinned = false;
147
150
  let unheldStop = false;
148
151
  let pending = [];
149
152
  let ready = null;
@@ -386,7 +389,7 @@ function createClient(url, options = {}) {
386
389
  const attempt = ++failures;
387
390
  const asked = (retry.retryAfter ?? retryAfter)(info);
388
391
  const named = asked >= 0;
389
- const delay = Math.min(MAX_TIMEOUT, named ? asked + backoff(attempt, false) : backoff(attempt, info.code === 1013));
392
+ const delay = Math.min(MAX_TIMEOUT$2, named ? asked + backoff(attempt, false) : backoff(attempt, info.code === 1013));
390
393
  serverWait = named || info.code === 1013;
391
394
  set({
392
395
  status: "reconnecting",
@@ -411,12 +414,13 @@ function createClient(url, options = {}) {
411
414
  if (!wanted) return;
412
415
  if (to !== void 0) moved = to;
413
416
  if (snapshot.status === "open") open(true);
414
- }, Math.min(MAX_TIMEOUT, Math.random() * (within ?? 0)));
417
+ }, Math.min(MAX_TIMEOUT$2, Math.random() * (within ?? 0)));
415
418
  }
416
419
  function fail(reason) {
417
420
  wanted = false;
418
421
  opened = false;
419
422
  unheldStop = refs === 0;
423
+ clearTimeout(teardownTimer);
420
424
  unbindWindow();
421
425
  stopMigrating();
422
426
  pending = [];
@@ -531,6 +535,7 @@ function createClient(url, options = {}) {
531
535
  function begin() {
532
536
  wanted = true;
533
537
  unheldStop = false;
538
+ unpinned = false;
534
539
  if (snapshot.status === "idle" || snapshot.status === "closed") {
535
540
  opened = false;
536
541
  if (ready?.settled) ready = null;
@@ -569,9 +574,11 @@ function createClient(url, options = {}) {
569
574
  }
570
575
  function close(code = 1e3, reason) {
571
576
  stop(code, reason);
577
+ unpinned ||= pinned;
572
578
  pinned = false;
573
579
  opened = false;
574
580
  unheldStop = refs === 0;
581
+ clearTimeout(teardownTimer);
575
582
  set({
576
583
  status: "closed",
577
584
  attempt: 0,
@@ -581,6 +588,7 @@ function createClient(url, options = {}) {
581
588
  }
582
589
  function reconnect() {
583
590
  if (!getImpl()) return;
591
+ if (unpinned) pinned = true;
584
592
  clearTimeout(retryTimer);
585
593
  retryTimer = void 0;
586
594
  stopSocketTimers();
@@ -662,7 +670,7 @@ function createClient(url, options = {}) {
662
670
  reconnect,
663
671
  migrate,
664
672
  acquire,
665
- [INSPECT]: () => ({ queued: pending.length })
673
+ [INSPECT$1]: () => ({ queued: pending.length })
666
674
  };
667
675
  }
668
676
  /**
@@ -687,8 +695,7 @@ function createClient(url, options = {}) {
687
695
  function createWebSocket(url, options) {
688
696
  return createClient(url, options);
689
697
  }
690
- //#endregion
691
- //#region src/topics.ts
698
+ // src/topics.ts
692
699
  /** @internal Option key for a callback run when nothing holds a topic anymore. Used by feeds. */
693
700
  const ON_RELEASE = Symbol("react-websocket.onRelease");
694
701
  /**
@@ -736,8 +743,6 @@ function createWebSocketTopics(client, options) {
736
743
  if (options.unsubscribe) client.send(options.unsubscribe(topic));
737
744
  }
738
745
  const off = client.on("open", () => {
739
- sentOn = client.socket;
740
- sent = /* @__PURE__ */ new Set();
741
746
  for (const topic of counts.keys()) subscribe(topic);
742
747
  });
743
748
  return {
@@ -775,8 +780,7 @@ function createWebSocketTopics(client, options) {
775
780
  }
776
781
  };
777
782
  }
778
- //#endregion
779
- //#region src/feeds.ts
783
+ // src/feeds.ts
780
784
  /**
781
785
  * Subscribe to topics whose messages carry a sequence number, and get each message once, in
782
786
  * order, across reconnects:
@@ -865,8 +869,7 @@ function createWebSocketFeeds(client, options) {
865
869
  }
866
870
  };
867
871
  }
868
- //#endregion
869
- //#region src/latency.ts
872
+ // src/latency.ts
870
873
  const EMPTY = Object.freeze({
871
874
  rtt: void 0,
872
875
  offset: void 0
@@ -920,6 +923,7 @@ function createWebSocketLatency(client, options) {
920
923
  stop();
921
924
  inFlight.clear();
922
925
  samples = [];
926
+ if (client.getSnapshot().status !== "open") return;
923
927
  ping();
924
928
  timer = setInterval(ping, interval);
925
929
  }
@@ -974,8 +978,7 @@ function createWebSocketLatency(client, options) {
974
978
  }
975
979
  };
976
980
  }
977
- //#endregion
978
- //#region src/presence.ts
981
+ // src/presence.ts
979
982
  const VOLATILE$1 = { volatile: true };
980
983
  /**
981
984
  * Share per-peer state that expires, for presence, live cursors and selections.
@@ -1002,6 +1005,7 @@ const VOLATILE$1 = { volatile: true };
1002
1005
  */
1003
1006
  function createWebSocketPresence(client, options) {
1004
1007
  const timeout = options.timeout ?? 3e4;
1008
+ const refresh = options.refresh ?? timeout / 3;
1005
1009
  const interval = 1e3 / (options.maxRate ?? 20);
1006
1010
  const peers = /* @__PURE__ */ new Map();
1007
1011
  const listeners = /* @__PURE__ */ new Set();
@@ -1011,16 +1015,21 @@ function createWebSocketPresence(client, options) {
1011
1015
  let sendTimer;
1012
1016
  let refreshTimer;
1013
1017
  let expiryTimer;
1018
+ let disposed = false;
1014
1019
  function changed() {
1015
1020
  snapshot = [...peers.values()];
1016
1021
  for (const listener of [...listeners]) listener();
1017
1022
  }
1018
- function sendNow() {
1023
+ function stopSending() {
1019
1024
  clearTimeout(sendTimer);
1020
- sendTimer = void 0;
1025
+ clearTimeout(refreshTimer);
1026
+ sendTimer = refreshTimer = void 0;
1027
+ }
1028
+ function sendNow() {
1029
+ stopSending();
1021
1030
  if (!own) return;
1022
1031
  lastSent = Date.now();
1023
- client.send(options.send(own.state), VOLATILE$1);
1032
+ if (client.send(options.send(own.state), VOLATILE$1)) refreshTimer = setTimeout(sendNow, refresh);
1024
1033
  }
1025
1034
  function expire() {
1026
1035
  expiryTimer = void 0;
@@ -1035,26 +1044,36 @@ function createWebSocketPresence(client, options) {
1035
1044
  if (next < Infinity) expiryTimer = setTimeout(expire, next - now);
1036
1045
  if (removed) changed();
1037
1046
  }
1038
- const offs = [client.on("open", sendNow), client.on("message", (message) => {
1039
- const update = options.receive(message);
1040
- if (!update) return;
1041
- if (update.state === null) {
1042
- if (!peers.delete(update.peer)) return;
1043
- } else {
1044
- peers.set(update.peer, {
1045
- peer: update.peer,
1046
- state: update.state,
1047
- updatedAt: Date.now()
1048
- });
1049
- expiryTimer ??= setTimeout(expire, timeout);
1050
- }
1051
- changed();
1052
- })];
1047
+ const offs = [
1048
+ client.on("open", sendNow),
1049
+ client.on("message", (message) => {
1050
+ const update = options.receive(message);
1051
+ if (!update) return;
1052
+ if (update.state === null) {
1053
+ if (!peers.delete(update.peer)) return;
1054
+ } else {
1055
+ peers.set(update.peer, {
1056
+ peer: update.peer,
1057
+ state: update.state,
1058
+ updatedAt: Date.now()
1059
+ });
1060
+ expiryTimer ??= setTimeout(expire, timeout);
1061
+ }
1062
+ changed();
1063
+ }),
1064
+ client.subscribe(() => {
1065
+ if (client.getSnapshot().status !== "closed" || !peers.size) return;
1066
+ peers.clear();
1067
+ clearTimeout(expiryTimer);
1068
+ expiryTimer = void 0;
1069
+ changed();
1070
+ })
1071
+ ];
1053
1072
  return {
1054
1073
  client,
1055
1074
  set(state) {
1075
+ if (disposed) return;
1056
1076
  own = { state };
1057
- refreshTimer ??= setInterval(sendNow, options.refresh ?? timeout / 3);
1058
1077
  if (sendTimer !== void 0) return;
1059
1078
  const wait = lastSent + interval - Date.now();
1060
1079
  if (wait <= 0) sendNow();
@@ -1062,10 +1081,7 @@ function createWebSocketPresence(client, options) {
1062
1081
  },
1063
1082
  leave() {
1064
1083
  own = void 0;
1065
- clearTimeout(sendTimer);
1066
- sendTimer = void 0;
1067
- clearInterval(refreshTimer);
1068
- refreshTimer = void 0;
1084
+ stopSending();
1069
1085
  if (options.leave) client.send(options.leave(), VOLATILE$1);
1070
1086
  },
1071
1087
  getSnapshot: () => snapshot,
@@ -1076,17 +1092,20 @@ function createWebSocketPresence(client, options) {
1076
1092
  };
1077
1093
  },
1078
1094
  dispose() {
1079
- own = void 0;
1080
- clearTimeout(sendTimer);
1081
- clearInterval(refreshTimer);
1095
+ disposed = true;
1096
+ stopSending();
1082
1097
  clearTimeout(expiryTimer);
1083
1098
  for (const off of offs) off();
1084
1099
  }
1085
1100
  };
1086
1101
  }
1087
- //#endregion
1088
- //#region src/requests.ts
1102
+ // src/requests.ts
1089
1103
  const lastIds = /* @__PURE__ */ new WeakMap();
1104
+ /** @internal Method key on the client for what the devtools show, such as its queue length. */
1105
+ const INSPECT = Symbol.for("react-websocket.inspect");
1106
+ /** How many messages `client` holds in its send queue, if it tells. */
1107
+ const queued = (client) => client[INSPECT]?.().queued;
1108
+ const MAX_TIMEOUT$1 = 2 ** 31 - 1;
1090
1109
  const noop = () => {};
1091
1110
  /**
1092
1111
  * Send requests and await their replies, matched by an id the library generates.
@@ -1108,6 +1127,7 @@ const noop = () => {};
1108
1127
  */
1109
1128
  function createWebSocketRequests(client, options) {
1110
1129
  const waiting = /* @__PURE__ */ new Map();
1130
+ let disposed = false;
1111
1131
  function endWhere(test, reason, cancel) {
1112
1132
  for (const entry of [...waiting.values()]) if (test(entry)) entry.end(true, reason(), cancel);
1113
1133
  }
@@ -1140,6 +1160,10 @@ function createWebSocketRequests(client, options) {
1140
1160
  done(true, signal.reason);
1141
1161
  return noop;
1142
1162
  }
1163
+ if (disposed) {
1164
+ done(true, /* @__PURE__ */ new Error("Requests were disposed"));
1165
+ return noop;
1166
+ }
1143
1167
  if (client.getSnapshot().status === "closed") {
1144
1168
  done(true, /* @__PURE__ */ new Error("WebSocket is closed: request not sent"));
1145
1169
  return noop;
@@ -1153,7 +1177,7 @@ function createWebSocketRequests(client, options) {
1153
1177
  const onAbort = () => entry.end(true, signal.reason, true);
1154
1178
  function arm() {
1155
1179
  clearTimeout(timer);
1156
- if (timeout > 0 && timeout < Infinity) timer = setTimeout(() => entry.end(true, new DOMException(`Request ${id} timed out after ${timeout}ms`, "TimeoutError"), true), timeout);
1180
+ if (timeout > 0 && timeout <= MAX_TIMEOUT$1) timer = setTimeout(() => entry.end(true, new DOMException(`Request ${id} timed out after ${timeout}ms`, "TimeoutError"), true), timeout);
1157
1181
  }
1158
1182
  const entry = {
1159
1183
  socket: null,
@@ -1180,7 +1204,8 @@ function createWebSocketRequests(client, options) {
1180
1204
  waiting.set(key, entry);
1181
1205
  signal?.addEventListener("abort", onAbort, { once: true });
1182
1206
  arm();
1183
- if (client.getSnapshot().status === "idle") entry.end(true, /* @__PURE__ */ new Error("WebSocket is idle: request not sent"));
1207
+ const { status } = client.getSnapshot();
1208
+ if (status === "idle" || status === "closed") entry.end(true, /* @__PURE__ */ new Error(`WebSocket is ${status}: request not sent`));
1184
1209
  else try {
1185
1210
  if (client.send(options.send(message, id), {
1186
1211
  ...requestOptions,
@@ -1190,7 +1215,7 @@ function createWebSocketRequests(client, options) {
1190
1215
  }
1191
1216
  })) entry.socket = client.socket;
1192
1217
  else if (client.socket?.readyState === 1) entry.end(true, /* @__PURE__ */ new Error("WebSocket send buffer is full: request dropped"));
1193
- else if (requestOptions.volatile) entry.end(true, /* @__PURE__ */ new Error("WebSocket is not open: request dropped"));
1218
+ else if (requestOptions.volatile || queued(client) === 0) entry.end(true, /* @__PURE__ */ new Error("WebSocket is not open: request dropped"));
1194
1219
  } catch (error) {
1195
1220
  entry.end(true, error);
1196
1221
  }
@@ -1244,14 +1269,15 @@ function createWebSocketRequests(client, options) {
1244
1269
  },
1245
1270
  pending: () => waiting.size,
1246
1271
  dispose() {
1272
+ disposed = true;
1247
1273
  offs.forEach((off) => off());
1248
1274
  endWhere(() => true, () => /* @__PURE__ */ new Error("Requests were disposed"), true);
1249
1275
  }
1250
1276
  };
1251
1277
  }
1252
- //#endregion
1253
- //#region src/responder.ts
1278
+ // src/responder.ts
1254
1279
  const abortError = (message) => new DOMException(message, "AbortError");
1280
+ const MAX_TIMEOUT = 2 ** 31 - 1;
1255
1281
  /**
1256
1282
  * Answer requests the server sends: run a handler for tools that only exist in the browser
1257
1283
  * (selection, clipboard, geolocation), or let a person answer, e.g. to approve an agent's action.
@@ -1310,6 +1336,7 @@ function createWebSocketResponder(client, options) {
1310
1336
  reply(id, () => options.error(id, error));
1311
1337
  return;
1312
1338
  }
1339
+ const socket = client.socket;
1313
1340
  const controller = new AbortController();
1314
1341
  let timer;
1315
1342
  let done = false;
@@ -1321,7 +1348,7 @@ function createWebSocketResponder(client, options) {
1321
1348
  clearTimeout(timer);
1322
1349
  if (waiting.includes(request)) setWaiting(waiting.filter((entry) => entry !== request));
1323
1350
  if (reason !== void 0) controller.abort(reason);
1324
- return build ? reply(id, build) : false;
1351
+ return build && socket === client.socket ? reply(id, build) : false;
1325
1352
  }
1326
1353
  const answeredElsewhere = () => running ? abortError(`Request ${id} was answered elsewhere`) : void 0;
1327
1354
  const request = {
@@ -1336,14 +1363,14 @@ function createWebSocketResponder(client, options) {
1336
1363
  settle(() => options.error(id, error), error);
1337
1364
  };
1338
1365
  entries.set(key, {
1339
- socket: client.socket,
1366
+ socket,
1340
1367
  drop: (reason) => {
1341
1368
  settle(null, reason);
1342
1369
  },
1343
1370
  fail
1344
1371
  });
1345
1372
  const timeout = incoming.timeout ?? options.timeout ?? Infinity;
1346
- if (timeout > 0 && timeout < Infinity) timer = setTimeout(() => fail(new DOMException(`Request ${id} was not answered within ${timeout}ms`, "TimeoutError")), timeout);
1373
+ if (timeout > 0 && timeout <= MAX_TIMEOUT) timer = setTimeout(() => fail(new DOMException(`Request ${id} was not answered within ${timeout}ms`, "TimeoutError")), timeout);
1347
1374
  const { handler } = registration;
1348
1375
  if (!handler) {
1349
1376
  setWaiting([...waiting, request]);
@@ -1358,7 +1385,10 @@ function createWebSocketResponder(client, options) {
1358
1385
  request.reject(error);
1359
1386
  });
1360
1387
  }
1361
- const offs = [client.on("message", (message) => {
1388
+ const gone = /* @__PURE__ */ new WeakSet();
1389
+ let current = client.socket;
1390
+ const offs = [client.on("message", (message, event) => {
1391
+ if (gone.has(event.target)) return;
1362
1392
  const incoming = options.request(message);
1363
1393
  if (incoming != null) {
1364
1394
  receive(incoming);
@@ -1367,6 +1397,8 @@ function createWebSocketResponder(client, options) {
1367
1397
  const id = options.cancel?.(message);
1368
1398
  if (id != null) entries.get(String(id))?.drop(abortError(`Request ${id} was cancelled`));
1369
1399
  }), client.subscribe(() => {
1400
+ if (current && current !== client.socket) gone.add(current);
1401
+ current = client.socket;
1370
1402
  for (const entry of [...entries.values()]) if (entry.socket !== client.socket) entry.drop(abortError("WebSocket connection was lost before the request was answered"));
1371
1403
  })];
1372
1404
  return {
@@ -1395,8 +1427,7 @@ function createWebSocketResponder(client, options) {
1395
1427
  }
1396
1428
  };
1397
1429
  }
1398
- //#endregion
1399
- //#region src/runs.ts
1430
+ // src/runs.ts
1400
1431
  function randomId() {
1401
1432
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
1402
1433
  }
@@ -1503,8 +1534,8 @@ function createWebSocketRuns(client, options) {
1503
1534
  function follow(runId, policy, value = options.initial) {
1504
1535
  policies.set(runId, policy);
1505
1536
  remember(runId, policy);
1506
- set(runId, { value });
1507
1537
  releases.set(runId, feeds.acquire(runId));
1538
+ set(runId, { value });
1508
1539
  }
1509
1540
  function cancel(runId) {
1510
1541
  const message = options.cancel;
@@ -1552,7 +1583,7 @@ function createWebSocketRuns(client, options) {
1552
1583
  const previous = status;
1553
1584
  status = client.getSnapshot().status;
1554
1585
  if (previous !== "open" || status === "open") return;
1555
- for (const [runId, policy] of policies) if (policy === "cancel") abort(runId);
1586
+ for (const [runId, policy] of [...policies]) if (policy === "cancel") abort(runId);
1556
1587
  }),
1557
1588
  feeds.dispose
1558
1589
  ];
@@ -1633,8 +1664,7 @@ function createWebSocketRuns(client, options) {
1633
1664
  }
1634
1665
  };
1635
1666
  }
1636
- //#endregion
1637
- //#region src/sendrate.ts
1667
+ // src/sendrate.ts
1638
1668
  const VOLATILE = { volatile: true };
1639
1669
  /**
1640
1670
  * Send high-rate state, such as aim, cursor or position, at a rate that adapts to the
@@ -1750,8 +1780,7 @@ function createWebSocketSendRate(client, options = {}) {
1750
1780
  }
1751
1781
  };
1752
1782
  }
1753
- //#endregion
1754
- //#region src/state.ts
1783
+ // src/state.ts
1755
1784
  /**
1756
1785
  * Keep state derived from a client's messages, like a reducer that runs on every message.
1757
1786
  * It starts listening immediately and keeps the state across reconnects; it doesn't open
@@ -1815,7 +1844,6 @@ function createWebSocketState(source, options) {
1815
1844
  dispose: source.on("message", (message) => update((current) => reduce(current, message), batch === "frame"))
1816
1845
  };
1817
1846
  }
1818
- //#endregion
1819
1847
  export { MessageError, createWebSocket, createWebSocketFeeds, createWebSocketLatency, createWebSocketPresence, createWebSocketRequests, createWebSocketResponder, createWebSocketRuns, createWebSocketSendRate, createWebSocketState, createWebSocketTopics, retryAfter, retryableClose };
1820
1848
 
1821
1849
  //# sourceMappingURL=core.js.map