开发者学堂课程【分布式系统开发调度技术:LinkPlatform 简介与开发入门】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/558/detail/7669
LinkPlatform 简介与开发入门(三)
三、入门开发实战
1.云端开发步骤
2.设备应用程序开发
1.
//设备身份三元组
const options ={ productKey: "RY8ExdyS6lU" , dev iceName: "bedRoomThe deviceSecret: " zJWfACDj regionId: " cn-shanghai]
2.
建立连接 //设备与云建立连接
const client = mqtt. getAliyunIotMqttClient (options);
3.上报数据
const topic . /sys/$(opt ions . productKey)/ $(opt ions . deviceName)/ thing/ event/property/post ; const pay loadJson = [ id: Date.now( ), params: l
temperature: Math . floor (Math. random() * 20) + 10), humidity: Math. floor( (Math. random() * 40) + 60),, method: " thing. event, property, post" client . publish(topic, JSON stringify(pay loadJson));
//iJAtopic
4.接收指令
client. subscribe(topic ) client . on( " message', function (topic, message)
console. log ("InReceived: topic="+ topic+" , message=" + mes sage
.toString()) console. log()
阿里云loT开发资源 loT物联网平台
https∶//www.aliyun.com/product/iot 产品技术文档 https∶//help.aliyun.com/product/30520.html loT 技术案例 https∶//yuque.com/wongxming/iot-tech 阿里云产品∶ loT 平台https∶//www.aliyun.com/product/iot 函数计算https∶/www.aliyun.com/product/fc 表格存储https∶//www.aliyun.com/product/ots OSS 存储https∶//www.aliyun.com/product/oss 人脸识别
https∶//data.aliyun.com/product/face