我对https://github.com/adamvr/MQTT.js的服务器做错了吗?我看到client.id
进来很好。其他一切都是未定义的;我使用 3.1 用户/通行证与另一个代理验证了 MQTT 客户端的信息,所以我知道问题不存在。
clients = { }
server = mqtt.createServer (client) =>
console.log 'Broker:mqtt:createServer'
# Catch when client connects
client.on 'connect', (packet) =>
console.log 'Broker:connect'
client.connack
returnCode: 0
client.id = packet.client
console.log 'version: ' + client.versionNum # undefined
console.log 'client: ' + client.id # COMES THROUGH FINE!
console.log 'username: ' + client.username # undefined
console.log 'password: ' + client.password # udefined
clients[client.id] = client
console.log 'clients: ' + JSON.stringify clients
...
server.listen 1883
我还在项目下创建了一个问题:https ://github.com/adamvr/MQTT.js/issues/22