diff options
author | Ty Dunn <ty@tydunn.com> | 2023-06-29 10:55:08 -0700 |
---|---|---|
committer | Ty Dunn <ty@tydunn.com> | 2023-06-29 10:55:08 -0700 |
commit | f09c4d53396e93c0d32307f1e87be6f6beed4c2e (patch) | |
tree | 35e0de8fe207b32c58a94224a625872cc2809105 /extension/src/continueIdeClient.ts | |
parent | 7d1d636a38b069e7b2e8f500779ef397ffee1c1e (diff) | |
parent | 481aa6dc53422746ce87259c4a22b4b1f6bef7ea (diff) | |
download | sncontinue-f09c4d53396e93c0d32307f1e87be6f6beed4c2e.tar.gz sncontinue-f09c4d53396e93c0d32307f1e87be6f6beed4c2e.tar.bz2 sncontinue-f09c4d53396e93c0d32307f1e87be6f6beed4c2e.zip |
Merge branch 'main' of github.com:continuedev/continue
Diffstat (limited to 'extension/src/continueIdeClient.ts')
-rw-r--r-- | extension/src/continueIdeClient.ts | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 8ab3e075..d983d93a 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -226,9 +226,18 @@ class IdeProtocolClient { } async getSessionId(): Promise<string> { - if (this.messenger === null) { - console.log("MESSENGER IS NULL"); - } + await new Promise((resolve, reject) => { + // Repeatedly try to connect to the server + const interval = setInterval(() => { + if ( + this.messenger && + this.messenger.websocket.readyState === 1 // 1 => OPEN + ) { + clearInterval(interval); + resolve(null); + } + }, 1000); + }); const resp = await this.messenger?.sendAndReceive("openGUI", {}); const sessionId = resp.sessionId; console.log("New Continue session with ID: ", sessionId); |