added web-socket

This commit is contained in:
2024-05-02 23:10:53 +02:00
parent 914a7228c2
commit 79e1525345
3 changed files with 102 additions and 0 deletions

View File

@ -5,4 +5,16 @@
<script setup lang="ts">
import Game from '@/components/Game.vue'
import Login from '@/components/screens/Login.vue'
import { useWebSocket } from '@vueuse/core'
import config from '@/config'
const { status, data, close } = useWebSocket(config.websocket_url, {
autoReconnect: {
retries: 3,
delay: 1000,
onFailed() {
alert('Failed to connect WebSocket after 3 retries')
},
},
})
</script>