@holo-js/flux 0.3.14 → 0.3.16
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/index.mjs +30 -30
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -481,38 +481,38 @@ function createHoloWebSocketConnector(options = {}) {
|
|
|
481
481
|
await connecting;
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
|
-
resolvedOptions = canDiscoverHoloWebSocketConnectorOptions(globals) ? await resolveHoloWebSocketConnectorOptions(options, globals) : options;
|
|
485
|
-
const scheme = resolveWebSocketScheme(resolvedOptions.scheme, globals);
|
|
486
|
-
const host = resolveBrowserHost(resolvedOptions.host, globals);
|
|
487
|
-
const port = resolvedOptions.port ?? 8080;
|
|
488
|
-
const path = resolvedOptions.path?.trim() || "/app";
|
|
489
|
-
const key = resolvedOptions.key?.trim() || "app-key";
|
|
490
|
-
const normalizedPath = `/${path.replace(/^\/+|\/+$/g, "")}`;
|
|
491
|
-
const url = `${scheme}://${host}:${port}${normalizedPath}/${encodeURIComponent(key)}`;
|
|
492
484
|
setStatus("connecting");
|
|
493
|
-
connecting =
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
485
|
+
connecting = (async () => {
|
|
486
|
+
resolvedOptions = canDiscoverHoloWebSocketConnectorOptions(globals) ? await resolveHoloWebSocketConnectorOptions(options, globals) : options;
|
|
487
|
+
const scheme = resolveWebSocketScheme(resolvedOptions.scheme, globals);
|
|
488
|
+
const host = resolveBrowserHost(resolvedOptions.host, globals);
|
|
489
|
+
const port = resolvedOptions.port ?? 8080;
|
|
490
|
+
const path = resolvedOptions.path?.trim() || "/app";
|
|
491
|
+
const key = resolvedOptions.key?.trim() || "app-key";
|
|
492
|
+
const normalizedPath = `/${path.replace(/^\/+|\/+$/g, "")}`;
|
|
493
|
+
const url = `${scheme}://${host}:${port}${normalizedPath}/${encodeURIComponent(key)}`;
|
|
494
|
+
await new Promise((resolve, reject) => {
|
|
495
|
+
const nextSocket = new WebSocketConstructor(url);
|
|
496
|
+
socket = nextSocket;
|
|
497
|
+
nextSocket.addEventListener("open", () => {
|
|
498
|
+
setStatus("connected");
|
|
499
|
+
flushSubscriptions();
|
|
500
|
+
resolve();
|
|
501
|
+
});
|
|
502
|
+
nextSocket.addEventListener("message", handleMessage);
|
|
503
|
+
nextSocket.addEventListener("close", () => {
|
|
504
|
+
socket = void 0;
|
|
505
|
+
for (const state of channels.values()) {
|
|
506
|
+
state.subscribed = false;
|
|
507
|
+
}
|
|
508
|
+
setStatus("disconnected");
|
|
509
|
+
});
|
|
510
|
+
nextSocket.addEventListener("error", () => {
|
|
511
|
+
setStatus("disconnected");
|
|
512
|
+
reject(new Error("[@holo-js/flux] WebSocket connection failed."));
|
|
513
|
+
});
|
|
514
514
|
});
|
|
515
|
-
}).finally(() => {
|
|
515
|
+
})().finally(() => {
|
|
516
516
|
connecting = void 0;
|
|
517
517
|
});
|
|
518
518
|
await connecting;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holo-js/flux",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.16",
|
|
4
4
|
"description": "Holo-JS Framework - framework-agnostic realtime client skeleton for broadcast and presence",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,12 +23,15 @@
|
|
|
23
23
|
"test": "vitest --run"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@holo-js/broadcast": "^0.3.
|
|
26
|
+
"@holo-js/broadcast": "^0.3.16"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.10.2",
|
|
30
30
|
"tsup": "^8.3.5",
|
|
31
31
|
"typescript": "^5.7.2",
|
|
32
32
|
"vitest": "^4.1.5"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": "^22.12.0 || ^24.0.0 || ^26.0.0"
|
|
33
36
|
}
|
|
34
37
|
}
|