MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / openLoop

Method openLoop

projects/runtime-client/src/client.ts:130–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128 }
129
130 private async openLoop(): Promise<void> {
131 while (!this.stopped) {
132 this.emitStatus(this.lastStatus === "disconnected" || this.lastStatus === "reconnecting" || this.retryMs > 1000 ? "reconnecting" : "connecting")
133 try {
134 await this.openOnce()
135 this.retryMs = 1000
136 return
137 } catch (error) {
138 if (!this.options.reconnect || (error instanceof RuntimeClientError && error.code === "unsupported_protocol_version")) throw error
139 this.emitStatus("reconnecting")
140 await delay(this.retryMs)
141 this.retryMs = Math.min(this.retryMs * 2, 15_000)
142 }
143 }
144 }
145
146 private openOnce(): Promise<void> {
147 return new Promise((resolve, reject) => {

Callers 1

connectMethod · 0.95

Calls 3

emitStatusMethod · 0.95
openOnceMethod · 0.95
delayFunction · 0.70

Tested by

no test coverage detected