aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/xtext/XtextWebSocketClient.ts
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/xtext/XtextWebSocketClient.ts')
-rw-r--r--subprojects/frontend/src/xtext/XtextWebSocketClient.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/subprojects/frontend/src/xtext/XtextWebSocketClient.ts b/subprojects/frontend/src/xtext/XtextWebSocketClient.ts
index 6bb7eec8..280ac875 100644
--- a/subprojects/frontend/src/xtext/XtextWebSocketClient.ts
+++ b/subprojects/frontend/src/xtext/XtextWebSocketClient.ts
@@ -204,7 +204,7 @@ export default class XtextWebSocketClient {
204 204
205 get state() { 205 get state() {
206 this.stateAtom.reportObserved(); 206 this.stateAtom.reportObserved();
207 return this.interpreter.state; 207 return this.interpreter.getSnapshot();
208 } 208 }
209 209
210 get opening(): boolean { 210 get opening(): boolean {
@@ -270,6 +270,12 @@ export default class XtextWebSocketClient {
270 return promise; 270 return promise;
271 } 271 }
272 272
273 setKeepAlive(keepAlive: boolean): void {
274 this.interpreter.send({
275 type: keepAlive ? 'GENERATION_STARTED' : 'GENERATION_ENDED',
276 });
277 }
278
273 private updateVisibility(): void { 279 private updateVisibility(): void {
274 this.interpreter.send(document.hidden ? 'TAB_HIDDEN' : 'TAB_VISIBLE'); 280 this.interpreter.send(document.hidden ? 'TAB_HIDDEN' : 'TAB_VISIBLE');
275 } 281 }
@@ -282,7 +288,10 @@ export default class XtextWebSocketClient {
282 log.debug('Creating WebSocket'); 288 log.debug('Creating WebSocket');
283 289
284 (async () => { 290 (async () => {
285 const { webSocketURL } = await fetchBackendConfig(); 291 let { webSocketURL } = await fetchBackendConfig();
292 if (webSocketURL === undefined) {
293 webSocketURL = `${window.origin.replace(/^http/, 'ws')}/xtext-service`;
294 }
286 this.openWebSocketWithURL(webSocketURL); 295 this.openWebSocketWithURL(webSocketURL);
287 })().catch((error) => { 296 })().catch((error) => {
288 log.error('Error while initializing connection', error); 297 log.error('Error while initializing connection', error);