Skip to main content

HELLO

Syntax

HELLO [protover [AUTH username password] [SETNAME clientname]]

Module

connection

Categories

connection fast

Description

Switch to a different protocol, optionally authenticating and setting the connection's name. This command returns a contextual client report.

Options

  • protover - The protocol version to switch to. The default is 2.
  • AUTH username password - Authenticate with the server using the specified username and password.
  • SETNAME clientname - Set the connection's name to the specified clientname.

Examples

When using the embedded API, there's no need to authenticate the API caller or set an alias for the caller. Therefore, only the set protocol functionality is available in embedded mode. You can set the protocol using the SetProtocol method:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
err := db.SetProtocol(2)

The method above changes the protocol to version 3. This is relevant when executing commands using the ExecuteCommand method. Since this methods returns a raw RESP response. It will not affect any other methods' return types as they return native go types.

SetProtocol return an error if the protocol version is not supported (i.e. not 2 or 3).