(ws) redis_subscribe and redis_publish can take a password + display subscribe response
This commit is contained in:
@ -12,6 +12,7 @@ namespace ix
|
||||
{
|
||||
int ws_redis_publish_main(const std::string& hostname,
|
||||
int port,
|
||||
const std::string& password,
|
||||
const std::string& channel,
|
||||
const std::string& message)
|
||||
{
|
||||
@ -22,6 +23,18 @@ namespace ix
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!password.empty())
|
||||
{
|
||||
std::string authResponse;
|
||||
if (!redisClient.auth(password, authResponse))
|
||||
{
|
||||
std::stringstream ss;
|
||||
std::cerr << "Cannot authenticated to redis" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cout << "Auth response: " << authResponse << ":" << port << std::endl;
|
||||
}
|
||||
|
||||
std::cerr << "Publishing message " << message
|
||||
<< " to " << channel << "..." << std::endl;
|
||||
if (!redisClient.publish(channel, message))
|
||||
|
Reference in New Issue
Block a user