summaryrefslogtreecommitdiffstats
path: root/iredis/data/commands/hello.md
diff options
context:
space:
mode:
Diffstat (limited to 'iredis/data/commands/hello.md')
-rw-r--r--iredis/data/commands/hello.md83
1 files changed, 55 insertions, 28 deletions
diff --git a/iredis/data/commands/hello.md b/iredis/data/commands/hello.md
index b7a9dc4..c229cc1 100644
--- a/iredis/data/commands/hello.md
+++ b/iredis/data/commands/hello.md
@@ -1,16 +1,41 @@
-Switch the connection to a different protocol. Redis version 6 or greater are
-able to support two protocols, the old protocol, RESP2, and a new one introduced
-with Redis 6, RESP3. RESP3 has certain advantages since when the connection is
-in this mode, Redis is able to reply with more semantical replies: for instance
-`HGETALL` will return a _map type_, so a client library implementation no longer
-requires to know in advance to translate the array into a hash before returning
-it to the caller. For a full coverage of RESP3 please
+Switch to a different protocol, optionally authenticating and setting the
+connection's name, or provide a contextual client report.
+
+Redis version 6 and above supports two protocols: the old protocol, RESP2, and a
+new one introduced with Redis 6, RESP3. RESP3 has certain advantages since when
+the connection is in this mode, Redis is able to reply with more semantical
+replies: for instance, `HGETALL` will return a _map type_, so a client library
+implementation no longer requires to know in advance to translate the array into
+a hash before returning it to the caller. For a full coverage of RESP3, please
[check this repository](https://github.com/antirez/resp3).
-Redis 6 connections starts in RESP2 mode, so clients implementing RESP2 do not
-need to change (nor there are short term plans to drop support for RESP2).
-Clients that want to handshake the RESP3 mode need to call the `HELLO` command,
-using "3" as first argument.
+In Redis 6 connections start in RESP2 mode, so clients implementing RESP2 do not
+need to updated or changed. There are no short term plans to drop support for
+RESP2, although future version may default to RESP3.
+
+`HELLO` always replies with a list of current server and connection properties,
+such as: versions, modules loaded, client ID, replication role and so forth.
+When called without any arguments in Redis 6.2 and its default use of RESP2
+protocol, the reply looks like this:
+
+ > HELLO
+ 1) "server"
+ 2) "redis"
+ 3) "version"
+ 4) "255.255.255"
+ 5) "proto"
+ 6) (integer) 2
+ 7) "id"
+ 8) (integer) 5
+ 9) "mode"
+ 10) "standalone"
+ 11) "role"
+ 12) "master"
+ 13) "modules"
+ 14) (empty array)
+
+Clients that want to handshake using the RESP3 mode need to call the `HELLO`
+command and specify the value "3" as the `protover` argument, like so:
> HELLO 3
1# "server" => "redis"
@@ -21,26 +46,28 @@ using "3" as first argument.
6# "role" => "master"
7# "modules" => (empty array)
-The `HELLO` command has a useful reply that will state a number of facts about
-the server: the exact version, the set of modules loaded, the client ID, the
-replication role and so forth. Because of that, and given that the `HELLO`
-command also works with "2" as argument, both in order to downgrade the protocol
-back to version 2, or just to get the reply from the server without switching
-the protocol, client library authors may consider using this command instead of
-the canonical `PING` when setting up the connection.
-
-This command accepts two non mandatory options:
-
-- `AUTH <username> <password>`: directly authenticate the connection other than
- switching to the specified protocol. In this way there is no need to call
- `AUTH` before `HELLO` when setting up new connections. Note that the username
- can be set to "default" in order to authenticate against a server that does
- not use ACLs, but the simpler `requirepass` mechanism of Redis before
+Because `HELLO` replies with useful information, and given that `protover` is
+optional or can be set to "2", client library authors may consider using this
+command instead of the canonical `PING` when setting up the connection.
+
+When called with the optional `protover` argument, this command switches the
+protocol to the specified version and also accepts the following options:
+
+- `AUTH <username> <password>`: directly authenticate the connection in addition
+ to switching to the specified protocol version. This makes calling `AUTH`
+ before `HELLO` unnecessary when setting up a new connection. Note that the
+ `username` can be set to "default" to authenticate against a server that does
+ not use ACLs, but rather the simpler `requirepass` mechanism of Redis prior to
version 6.
-- `SETNAME <clientname>`: this is equivalent to also call `CLIENT SETNAME`.
+- `SETNAME <clientname>`: this is the equivalent of calling `CLIENT SETNAME`.
@return
@array-reply: a list of server properties. The reply is a map instead of an
-array when RESP3 is selected. The command returns an error if the protocol
+array when RESP3 is selected. The command returns an error if the `protover`
requested does not exist.
+
+@history
+
+- `>= 6.2`: `protover` made optional; when called without arguments the command
+ reports the current connection's context.