MCPcopy
hub / github.com/TanStack/ai / ensureSubscription

Method ensureSubscription

packages/ai-client/src/chat-client.ts:707–718  ·  view source on GitHub ↗

* Ensure subscription loop is running, starting it if needed.

()

Source from the content-addressed store, hash-verified

705 * Ensure subscription loop is running, starting it if needed.
706 */
707 private ensureSubscription(): void {
708 if (!this.isSubscribed) {
709 this.subscribe()
710 return
711 }
712 if (
713 !this.subscriptionAbortController ||
714 this.subscriptionAbortController.signal.aborted
715 ) {
716 this.subscribe({ restart: true })
717 }
718 }
719
720 /**
721 * Create a promise that resolves when onStreamEnd fires.

Callers 1

streamResponseMethod · 0.95

Calls 1

subscribeMethod · 0.95

Tested by

no test coverage detected