new: [front:socketConnection] Added last-keep alive message
This commit is contained in:
parent
b79152a6e5
commit
8774d70759
1 changed files with 12 additions and 4 deletions
|
@ -1,9 +1,17 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from "vue"
|
import { ref, onMounted } from "vue"
|
||||||
import { socketConnected, zmqLastTime } from "@/socket";
|
import { socketConnected, zmqLastTime } from "@/socket";
|
||||||
|
|
||||||
const zmqLastTimeSecond = computed(() => {
|
const zmqLastTimeSecond = ref(0)
|
||||||
return parseInt(((new Date()).getTime() - zmqLastTime.value * 1000) / 1000)
|
|
||||||
|
function refreshLastTime() {
|
||||||
|
zmqLastTimeSecond.value = parseInt(((new Date()).getTime() - zmqLastTime.value * 1000) / 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setInterval(() => {
|
||||||
|
refreshLastTime()
|
||||||
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -27,7 +35,7 @@
|
||||||
online
|
online
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
{{ zmqLastTimeSecond }}s
|
Last keep-alive: {{ zmqLastTimeSecond }}s ago
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue