diff --git a/src/components/ChatWidget.vue b/src/components/ChatWidget.vue index 9537872..32a4349 100644 --- a/src/components/ChatWidget.vue +++ b/src/components/ChatWidget.vue @@ -127,7 +127,6 @@ } // Establish the WebSocket connection - console.log('Establishing WebSocket connection'); this.connectionStore.connect(token) }, diff --git a/src/socket.ts b/src/socket.ts index 16d3507..86628b7 100644 --- a/src/socket.ts +++ b/src/socket.ts @@ -30,6 +30,8 @@ import { io } from "socket.io-client"; // "undefined" means the URL will be computed from the `window.location` object const URL = import.meta.env.VITE_CHATBOT_URL +console.log(`setting up socket with ${URL}`) + export const socket = io( URL, { diff --git a/src/stores/connection.ts b/src/stores/connection.ts index 91eb102..99b9fa6 100644 --- a/src/stores/connection.ts +++ b/src/stores/connection.ts @@ -59,8 +59,13 @@ export const useConnectionStore = defineStore("connection", { * @param token - The authentication token. I.e. a JWT */ connect(token: string) { + console.log("attempting websocket connection") socket.auth = { token }; - socket.connect(); + try { + socket.connect() + } catch (error) { + console.log(`Error connecting to websocket ${error}`) + } } }, }); \ No newline at end of file diff --git a/vite.config.mts b/vite.config.mts index 5e5a48f..d60070f 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -44,6 +44,10 @@ export default defineConfig({ changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''), }, + '^/opey': { + target: 'http://localhost:5000/', + changeOrigin: true, + }, }, }, })