Use CLIENT GETNAME to read the name assigned to the current connection with CLIENT SETNAME.
Connections start without a name and the reply is null until one is set. The name belongs to a single connection and is lost when it closes; it exists to make connections recognizable in CLIENT LIST output when you are debugging which part of an application is doing what.
Syntax#
Arguments#
This command takes no arguments.
Important points#
- This is a connection-oriented command and is available over native Redis TCP, not the stateless REST endpoint.
- This command can expose administrative information or make a broad destructive change. Restrict it to trusted code paths.
Response#
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
| Protocol | Reply |
|---|---|
| RESP2 | Null bulk string or null array or Bulk string |
| RESP3 | Null or Bulk string |
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples#
TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.