0

I am writing a simple mqtt client which will connect with a mosquitto broker.

I have used the C++ wrapper (mosquittopp) of the mosquitto library to write the mqtt client. However, I don't know how to authenticate a client with username and password through functions provided by the mosquittopp wrapper while connecting.

I am looking for the implementation of following client-tool command with the help of mosquittopp.

mosquitto_pub -m "testing" -t test -u sheheryar -P coke
hardillb
  • 54,545
  • 11
  • 67
  • 105
shery6405
  • 105
  • 2
  • 13
  • Edit the question to include the code you already have (and what you've tried) then somebody will be able to help – hardillb Dec 06 '17 at 12:49

1 Answers1

1

You can set user and password before connecting with

mosquittopp::username_pw_set(sUser, sPassword);