jsflow-sdk 1.1.1 → 1.1.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/CHANGELOG.md CHANGED
@@ -6,6 +6,41 @@ All notable changes to `jsflow-sdk`. The format follows
6
6
  contract; metric names passed to `onMetric` are diagnostic and may change in
7
7
  any minor release.
8
8
 
9
+ ## [1.1.2] - 2026-11-22
10
+
11
+ A patch under the npm tag `latest`. Nothing in the API changes (`jsflow.d.ts`
12
+ is byte-identical to 1.1.1's), the wire version is still 2, and the messages
13
+ on the wire are the same bytes; peers on 1.1.0, 1.1.1 and 1.1.2 share a room.
14
+
15
+ ### Fixed
16
+
17
+ - **A peer whose links are slow (a relay far away) no longer goes silent for
18
+ seconds after someone joins.** Each peer worked out routes from the link
19
+ delays every peer announces, except for its own links, where it used the
20
+ delay it had measured. A new link is announced at 50 ms until its first
21
+ refresh, 10 s later; on a link through a distant relay (200 ms and more) the
22
+ two ends of a route each saw the other's way as shorter and passed messages
23
+ back and forth until they expired. A peer now costs its own links from the
24
+ announced delays too, so every peer agrees on the routes.
25
+
26
+ Measured on staging, one Chrome with 8 peers per room joined through the
27
+ US entry (relay-only peers among them): before, 30 pauses of 1.5 to 5.5 s
28
+ between messages from one peer and 800 packets dropped in loops; with
29
+ 1.1.2, the same rooms: none of either, and every reliable message arrived
30
+ once. Through the EU entry there were none before either. In the
31
+ simulator, with relayed links 75 to 125 ms slower each way: before, every
32
+ seed looped (a relay-only peer silent up to 7.0 s); now none.
33
+
34
+ ### Changed
35
+
36
+ - Routes are chosen a little differently, so latencies in the simulator move
37
+ within the limits the tests hold them to: a heavy stream at 5 % loss,
38
+ median 25 to 32 ms and 99th percentile 743 to 615 ms; ordinary traffic,
39
+ 99th percentile 282 to 288 ms; under reordering, 247 to 265 ms; a transfer
40
+ whose route changes through another peer, median 647 to 137 ms. A new link
41
+ is routed at its announced 50 ms until its refresh, as every other peer
42
+ already did.
43
+
9
44
  ## [1.1.1] - 2026-11-22
10
45
 
11
46
  A patch under the npm tag `latest`. Nothing in the API changes (`jsflow.d.ts`
package/README.md CHANGED
@@ -20,7 +20,7 @@ Or from the CDN, at an exact version with its integrity hash (`sri.json` in
20
20
  each version directory):
21
21
 
22
22
  ```html
23
- <script type="module" integrity="sha384-…" crossorigin src="https://cdn.jsflow.com/v1.1.1/jsflow.js"></script>
23
+ <script type="module" integrity="sha384-…" crossorigin src="https://cdn.jsflow.com/v1.1.2/jsflow.js"></script>
24
24
  ```
25
25
 
26
26
  The SDK starts a worker (`worker.js`, next to `jsflow.js`). Vite and webpack
package/jsflow.js CHANGED
@@ -1,4 +1,4 @@
1
- // jsflow-sdk 1.1.1. Licence: see LICENSE (https://jsflow.com). Built by client/build.js.
1
+ // jsflow-sdk 1.1.2. Licence: see LICENSE (https://jsflow.com). Built by client/build.js.
2
2
 
3
3
  // core/link-main.js
4
4
  function linkKind(stats) {
@@ -285,7 +285,7 @@ function ticketRegion(ticket) {
285
285
  return void 0;
286
286
  }
287
287
  }
288
- var SDK_VERSION = "1.1.1";
288
+ var SDK_VERSION = "1.1.2";
289
289
  var WIRE = 2;
290
290
  var MAX_DATAGRAM = 1052;
291
291
  var MAX_RELIABLE = 65536;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsflow-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "jsflow: peer-to-peer rooms for the browser (WebRTC mesh, signalling and relays as a service).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
package/sri.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.1.1",
3
- "jsflow.js": "sha384-ugDbrtqBevA7WJvu/IMV4128uc+iYLBFLq04YF8Nb5cOcUf5r6yErM9TAVc4KNrI",
4
- "worker.js": "sha384-K9nbXm7n5ia3bxGtbkYWmqlnSTpxGQmxz7/W+P3iLNnisWM8er+yhG7CCGOLwo7m",
2
+ "version": "1.1.2",
3
+ "jsflow.js": "sha384-6iaDEfAX53o/sELinRUcwhyTPcO+v1yX9sXNJKhf8U7yEEPXiKMRzRSRvVortkTA",
4
+ "worker.js": "sha384-59Il1fBPtlj1gK19+ZC7Ei361OucDLcAPFFKN2ozLC2RrRu5SOuHpS54+SDnQwOY",
5
5
  "jsflow.d.ts": "sha384-VM+jOFBiVG6Z3ElnDVldrvSTyha/lJh9kC8el+JL/77bYFOp6ScbTHFK2tCnFsN5"
6
6
  }
package/worker.js CHANGED
@@ -1,4 +1,4 @@
1
- // jsflow-sdk 1.1.1. Licence: see LICENSE (https://jsflow.com). Built by client/build.js.
1
+ // jsflow-sdk 1.1.2. Licence: see LICENSE (https://jsflow.com). Built by client/build.js.
2
2
 
3
3
  // core/header.js
4
4
  var VERSION = 2;
@@ -416,8 +416,8 @@ function meshNode(opts = {}) {
416
416
  if (routes) return routes;
417
417
  const dist = /* @__PURE__ */ new Map([[me, 0]]), first = /* @__PURE__ */ new Map(), done = /* @__PURE__ */ new Set();
418
418
  const cost = (a, b) => {
419
- if (a === me) return nbr.get(b)?.rtt ?? 50;
420
419
  const ra = lsdb.get(a)?.links.get(b), rb = lsdb.get(b)?.links.get(a);
420
+ if (a === me) return ra !== void 0 && rb !== void 0 ? (ra + rb) / 2 : nbr.get(b)?.rtt ?? 50;
421
421
  if (ra === void 0 || rb === void 0) return Infinity;
422
422
  const w = lsdb.get(a)?.will ?? 7;
423
423
  return (ra + rb) / 2 + 0.5 + (w === 0 ? 1e3 : (15 - w) * 2);