# PING

> Check that the connection and server respond, optionally echoing a message.

URL: https://docs.hotkv.com/commands/ping/

```
PING [message]
```

- Group: Connection
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`PING` checks that the server is reachable and processing commands. Without
an argument it replies `PONG`. With an argument it replies with that
argument. Health checks, connection pools and latency probes use it.

`PING` also works on a connection that is subscribed to channels (see
[SUBSCRIBE](https://docs.hotkv.com/commands/subscribe/index.md)), where most other commands are refused.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| No argument | Simple string `PONG` | Simple string `PONG` |
| With `message` | `message` as a bulk string | `message` as a bulk string |
| No argument, connection subscribed | Array of `"pong"` and an empty string | Simple string `PONG` |
| With `message`, connection subscribed | Array of `"pong"` and `message` | `message` as a bulk string |

More than one argument is refused with
`ERR wrong number of arguments for 'ping' command`.

## Examples

```
127.0.0.1:6379> PING
PONG
127.0.0.1:6379> PING "are you there?"
"are you there?"
```

## Compatibility

Same replies as Redis 7 and Valkey 8, including the two-element reply on a
subscribed RESP2 connection.

## See also

[ECHO](https://docs.hotkv.com/commands/echo/index.md), [HELLO](https://docs.hotkv.com/commands/hello/index.md), [TIME](https://docs.hotkv.com/commands/time/index.md)