From 9e66855dc6f42c90d1c859b8259ff0809bcb10d2 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Fri, 2 Feb 2024 19:01:19 -0600 Subject: [PATCH] ping on the wobseckot --- game.go | 2 ++ site/src/App.vue | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/game.go b/game.go index 9e8c9da..eac2875 100644 --- a/game.go +++ b/game.go @@ -41,6 +41,8 @@ func applyAction(g *game.Match, a action) error { return g.Apply(a.Player, 6) case "7": return g.Apply(a.Player, 7) + case "ping": + return nil default: return errWeirdAction } diff --git a/site/src/App.vue b/site/src/App.vue index 452cbe1..9e3e5ad 100644 --- a/site/src/App.vue +++ b/site/src/App.vue @@ -37,7 +37,13 @@ const toggleDark = useToggle(dark); const theme = computed(() => dark.value ? 'dark' : 'light'); const themeIcon = computed(() => dark.value ? 'mdi-moon-waxing-crescent' : 'mdi-white-balance-sunny'); -const { status, data, send, open } = useWebSocket(`wss://${window.location.host}/queue`, { immediate: false }); +const { status, data, send, open } = useWebSocket(`wss://${window.location.host}/queue`, { + immediate: false, + heartbeat: { + interval: 5000, + message: '{"action":"ping"}', + }, +}); const game = ref(null); const dealer = ref(null); watchEffect(() => {