move websocket globally and modify mainn page

This commit is contained in:
Adrian Zuercher
2025-05-06 05:33:54 +02:00
parent 488ce84ae9
commit a059d282ed
9 changed files with 176 additions and 101 deletions

21
src/boot/websocket.ts Normal file
View File

@@ -0,0 +1,21 @@
import { boot } from 'quasar/wrappers';
import type { QVueGlobals } from 'quasar';
import { initWebSocket } from 'src/services/websocket';
export default boot(({ app }) => {
const $q = app.config.globalProperties.$q as QVueGlobals;
const ws = initWebSocket('ws://127.0.0.1:8100/ws?id=quasar', $q);
app.config.globalProperties.$socket = ws;
ws.connect();
});
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$socket: {
connect: () => void;
close: () => void;
socket: WebSocket | null;
};
}
}