new: [front:socketConnection] Added last-keep alive message

This commit is contained in:
Sami Mokaddem 2024-07-04 11:30:44 +02:00
parent b79152a6e5
commit 8774d70759

View file

@ -1,9 +1,17 @@
<script setup>
import { computed } from "vue"
import { ref, onMounted } from "vue"
import { socketConnected, zmqLastTime } from "@/socket";
const zmqLastTimeSecond = computed(() => {
return parseInt(((new Date()).getTime() - zmqLastTime.value * 1000) / 1000)
const zmqLastTimeSecond = ref(0)
function refreshLastTime() {
zmqLastTimeSecond.value = parseInt(((new Date()).getTime() - zmqLastTime.value * 1000) / 1000)
}
onMounted(() => {
setInterval(() => {
refreshLastTime()
}, 1000)
})
</script>
@ -27,7 +35,7 @@
online
</template>
<template v-else>
{{ zmqLastTimeSecond }}s
Last keep-alive: {{ zmqLastTimeSecond }}s ago
</template>
</span>
</span>