@neta-art/cohub 1.3.0 → 1.3.1

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 (2) hide show
  1. package/dist/websocket.js +13 -0
  2. package/package.json +2 -2
package/dist/websocket.js CHANGED
@@ -610,6 +610,19 @@ export class WebsocketClient {
610
610
  });
611
611
  if (this.manuallyClosed)
612
612
  return;
613
+ if (typeof navigator !== "undefined" && navigator.onLine === false) {
614
+ await new Promise((resolve) => {
615
+ const fallbackTimer = setTimeout(resolve, this.reconnectMaxDelayMs);
616
+ const handleOnline = () => {
617
+ clearTimeout(fallbackTimer);
618
+ globalThis.removeEventListener?.("online", handleOnline);
619
+ resolve();
620
+ };
621
+ globalThis.addEventListener?.("online", handleOnline, { once: true });
622
+ });
623
+ if (this.manuallyClosed)
624
+ return;
625
+ }
613
626
  await this.connect().catch((error) => {
614
627
  this.emit("error", { error, recoverable: true });
615
628
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Cohub SDK for spaces, sessions, checkpoints, and realtime agent collaboration.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -44,7 +44,7 @@
44
44
  "README.md"
45
45
  ],
46
46
  "dependencies": {
47
- "@neta-art/cohub-protocol": "1.2.2"
47
+ "@neta-art/cohub-protocol": "1.2.3"
48
48
  },
49
49
  "devDependencies": {
50
50
  "typescript": "^6.0.3"