I am trying to connect mqtt using with authentication, getting error like "AMQJS0008I Socket closed.". It was working without authentication.
My code:
var client = new Paho.MQTT.Client("domain", port, "myClientId" + new Date().getTime());
client.connect({userName:'srinivas',password:'123456',onSuccess:onConnect,onFailure:doFail,useSSL:true,cleanSession:false});
MYSQL:
auth_opt_backends mysql
auth_plugin auth-plug.so
auth_opt_host localhost
auth_opt_port port
auth_opt_dbname db
auth_opt_user username
auth_opt_pass password
auth_opt_userquery SELECT pw FROM users WHERE username = '%s'
auth_opt_superquery SELECT COUNT(*) FROM users WHERE username = '%s' AND super = 1
Hi,
I am trying to connect mqtt using with authentication, getting error like "AMQJS0008I Socket closed.". It was working without authentication.
My code:
var client = new Paho.MQTT.Client("domain", port, "myClientId" + new Date().getTime()); client.connect({userName:'srinivas',password:'123456',onSuccess:onConnect,onFailure:doFail,useSSL:true,cleanSession:false});
mosquittio config file:
allow_anonymous false
MONGODB: auth_opt_backends mongo auth_plugin auth-plug.so auth_opt_mongo_uri mongodb://localhost:port auth_opt_mongo_user username auth_opt_mongo_password password auth_opt_mongo_database db auth_opt_mongo_collection_users users auth_opt_mongo_collection_topics topics
MYSQL: auth_opt_backends mysql auth_plugin auth-plug.so auth_opt_host localhost auth_opt_port port auth_opt_dbname db auth_opt_user username auth_opt_pass password auth_opt_userquery SELECT pw FROM users WHERE username = '%s' auth_opt_superquery SELECT COUNT(*) FROM users WHERE username = '%s' AND super = 1
Please help me.
Thanks