From 9e796dd66c0de4457765fb61329be78ed918c00d Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 12 Oct 2024 12:14:19 +0300 Subject: [PATCH] hicli/json: handle ping commands --- hicli/json.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hicli/json.go b/hicli/json.go index df853c33..a27fd007 100644 --- a/hicli/json.go +++ b/hicli/json.go @@ -70,6 +70,12 @@ func (h *HiClient) dispatchCurrentState() { } func (h *HiClient) SubmitJSONCommand(ctx context.Context, req *JSONCommand) *JSONCommand { + if req.Command == "ping" { + return &JSONCommand{ + Command: "pong", + RequestID: req.RequestID, + } + } log := h.Log.With().Int64("request_id", req.RequestID).Str("command", req.Command).Logger() ctx, cancel := context.WithCancelCause(ctx) defer func() {