diff --git a/game.go b/game.go index cdf3e9b..faf1631 100644 --- a/game.go +++ b/game.go @@ -42,7 +42,7 @@ func applyAction(g *game.Match, a action) error { case "7": return g.Apply(a.Player, 7) case "ping": - return nil + return errJustAPing default: return errWeirdAction } @@ -101,7 +101,7 @@ func gameActor(ctx context.Context, g *game.Match, dealer, chall person, join <- broadcast(ctx, g, dealer, chall, obs) g.NextGame() broadcast(ctx, g, dealer, chall, obs) - case game.ErrWrongTurn: // do nothing + case game.ErrWrongTurn, errJustAPing: // do nothing case errWeirdAction: slog.WarnContext(ctx, "nonsense action", "from", a.Player, "action", a.Action) default: @@ -174,5 +174,6 @@ func gameOver(ctx context.Context, dealer, chall person, obs []observer) { var ( errWeirdAction = errors.New("unknown action") + errJustAPing = errors.New("just a ping") errMatchExpired = errors.New("there is a time limit on matches please") ) diff --git a/site/src/App.vue b/site/src/App.vue index f7722f2..76991f8 100644 --- a/site/src/App.vue +++ b/site/src/App.vue @@ -40,7 +40,7 @@ const themeIcon = computed(() => dark.value ? 'mdi-moon-waxing-crescent' : 'mdi- const { status, data, send, open } = useWebSocket(`wss://${window.location.host}/queue`, { immediate: false, heartbeat: { - interval: 5000, + interval: 1000, message: '{"action":"ping"}', }, });