From 17cbf4f39d631e0efe67fe5d6cd6852fc72261f8 Mon Sep 17 00:00:00 2001 From: Riccardo De Benedictis Date: Tue, 19 Nov 2024 09:58:52 +0100 Subject: [PATCH] Bump coco-gui version to 0.5.4 and add socket_host for WebSocket connections --- coco-gui/package.json | 2 +- coco-gui/src/coco.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/coco-gui/package.json b/coco-gui/package.json index 29d7b77..0958fa0 100644 --- a/coco-gui/package.json +++ b/coco-gui/package.json @@ -1,6 +1,6 @@ { "name": "coco-gui", - "version": "0.5.3", + "version": "0.5.4", "repository": { "type": "git", "url": "git+https://github.com/ratioSolver/cocoGUI.git" diff --git a/coco-gui/src/coco.ts b/coco-gui/src/coco.ts index ba7ded7..2863aa8 100644 --- a/coco-gui/src/coco.ts +++ b/coco-gui/src/coco.ts @@ -44,6 +44,7 @@ export namespace coco { user_type: taxonomy.Type | null = null; user: (taxonomy.Item & { personal_data: Record }) | null = null; host: string = 'http://localhost:8080'; + socket_host: string = 'ws://localhost:8080'; auth: boolean = false; types: Map; items: Map; @@ -89,6 +90,7 @@ export namespace coco { */ init(host: string = 'localhost', port: number = 8080, ssl: boolean = false, auth: boolean = false): void { this.host = (ssl ? 'https' : 'http') + '://' + host + ':' + port; + this.socket_host = (ssl ? 'wss' : 'ws') + '://' + host + ':' + port; console.log('CoCo server:', this.host); this.auth = auth; console.log('Authentication:', this.auth); @@ -347,8 +349,8 @@ export namespace coco { * @param timeout The timeout value in milliseconds for reconnecting to the server if the connection is closed. Default is 5000. */ connect(token: string | null = null, timeout = 5000) { - console.debug('Connecting to CoCo server ' + this.host + '/coco'); - this.socket = new WebSocket(this.host + '/coco'); + console.debug('Connecting to CoCo server ' + this.socket_host + '/coco'); + this.socket = new WebSocket(this.socket_host + '/coco'); this.socket.onopen = () => { console.debug('Connected to CoCo server'); if (token) {