@rdlabo/ionic-angular-kit 21.3.4 → 21.4.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.
@@ -1774,6 +1774,29 @@ class KitRealtimeConnection {
1774
1774
  resetConnectionState() {
1775
1775
  this.#reconnectAttempt = 0;
1776
1776
  }
1777
+ /** Register lifecycle listeners and establish the currently requested targets. */
1778
+ async startConnection() {
1779
+ await this.registerLifecycleListeners();
1780
+ if (!this.shouldConnect) {
1781
+ this.removeLifecycleListeners();
1782
+ return;
1783
+ }
1784
+ await this.open();
1785
+ }
1786
+ /** End the current connection session and release all lifecycle resources. */
1787
+ stopConnection() {
1788
+ this.resetConnectionState();
1789
+ this.suspend();
1790
+ this.removeLifecycleListeners();
1791
+ }
1792
+ /** Rebuild targets while preserving the owning session's connection intent and listeners. */
1793
+ async refreshConnectionTargets() {
1794
+ if (!this.shouldConnect) {
1795
+ return;
1796
+ }
1797
+ this.suspend();
1798
+ await this.open();
1799
+ }
1777
1800
  /** Open missing targets, preserving healthy sockets when another target fails. */
1778
1801
  async open() {
1779
1802
  const hasMissingTarget = this.#targets.size === 0 || [...this.#targets.keys()].some((key) => !this.#sockets.has(key));