我正在使用azure-iot-device-http,并运行入门代码:
var clientFromConnectionString = require('azure-iot-device-http').clientFromConnectionString;
var Message = require('azure-iot-device').Message;
var connectionString = 'myHostname,myDevice,myKey;
var client = clientFromConnectionString(connectionString);
var msg = new Message('some data from my device');
client.sendEvent(msg, function (err) {
if (err) console.log(err.toString());
});
client.getReceiver(function (err, rcv) {
rcv.on('message', function (msg) {
console.log(msg);
rcv.complete(msg, function () {
console.log('completed');
});
});
rcv.on('errorReceived', function (err) {
console.warn(err);
});
});
但我收到此错误:
TypeError:client.getReceiver 不是函数