@liberfi.io/react-predict 0.1.67 → 0.1.69

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 CHANGED
@@ -505,7 +505,7 @@ var PredictWsClient = class {
505
505
  this.reconnectMax = config.reconnectMaxInterval ?? DEFAULT_RECONNECT_MAX;
506
506
  this.pingMs = config.pingInterval ?? DEFAULT_PING_INTERVAL;
507
507
  this.pongTimeoutMs = config.pongTimeout ?? DEFAULT_PONG_TIMEOUT;
508
- if (config.autoConnect !== false) {
508
+ if (config.autoConnect !== false && typeof window !== "undefined") {
509
509
  this.connect();
510
510
  }
511
511
  }
@@ -513,6 +513,7 @@ var PredictWsClient = class {
513
513
  // Connection management
514
514
  // -------------------------------------------------------------------------
515
515
  connect() {
516
+ if (typeof window === "undefined") return;
516
517
  if (this.ws && (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING)) {
517
518
  return;
518
519
  }