9 client.on(connect,function(connack){
10 if(connack.returnCode == 0){
11 client.publish("home/2ndfloor/201/temperature",JSON.stringify({curre nt:25}),{qos: 1}, function(err){
12 if(err == undefined){
13 console.log("publish finished")
14 client.end()
15 }
16 else{
17 console.log("Publish failed")
18 }
19 })
20 }else{
21 console.log(Connection faild: ${connack.returnCode})
22 }
23 })
24
我是个新手,我想问一下这段代码中的第12行的err是什么个什么东西,应该怎样理解它,有那位高手能指点一下?“mqtt.Client#publish(topic, message, [options], [callback])
callback - function (err), fired when the QoS handling completes, or at the next tick if QoS 0. An error occurs if client is disconnecting.” 这段的意思是不是讲这是这个mqtt的API函数返回的固定格式?