【发布时间】:2017-03-23 11:32:30
【问题描述】:
我正在使用 mqtt paho javascript 客户端库连接到 mqtt 服务器,我可以使用用户名和密码连接到服务器,现在的问题是......如果用户输入错误的用户名或密码,我如何警告用户。i followed this link 如果用户凭据错误,是否有任何 onFailure 函数来报告错误??
client.connect({onSuccess:this.onConnect.bind(this),userName:Name,password:Password},{onFailure:console.log("failed")});
onConnect() {
// Once a connection has been made, make a subscription and send a message.
console.log("onConnect");
}
即使我能够连接,我也只能在控制台中看到“onConnect”和“失败”消息
【问题讨论】: