当前位置: 首页 > news >正文

有教做桥梁质检资料的网站吗简述网站建设的基本过程

有教做桥梁质检资料的网站吗,简述网站建设的基本过程,网站定制怎么选择,python 网站开发 视频没有实际接触过iOT的流程,应该实际使用比这个接口返回要复杂,只是演示~希望能参与实际的接口接入,而不是只展示个假数据。 启动RabbitQ 使用的是3.8.5 启动命令 RabbitMQ Service - start RabbitMQ Command Prompt rabbitmqctl start_app …

没有实际接触过iOT的流程,应该实际使用比这个接口返回要复杂,只是演示~希望能参与实际的接口接入,而不是只展示个假数据。

启动RabbitQ

使用的是3.8.5 启动命令

RabbitMQ Service - start
RabbitMQ Command Prompt
rabbitmqctl  start_app
rabbitmq -plugins enable  rabbitmq_management
rabbitmq-plugins enable rabbitmq_web_mqtt
rabbitmq-plugins enable rabbitmq_mqtt
访问 http://localhost:15672

     账号:guest       密码:guest

查看命令:rabbitmq-plugins list

1883端口已开

MQTT模拟收发

模拟IoT设备发送

import mqtt from 'mqtt'
const options = {username:"guest",password:"guest"
}var client = mqtt.connect("mqtt://localhost:1883", options);function sendTemperature() {// 生成一个0到40之间的随机温度值const temperature = Math.floor(Math.random() * 40);const now = new Date();const hours = now.getHours();const minutes = now.getMinutes();const seconds = now.getSeconds();const ioTdata = `Time:${hours}:${minutes}:${seconds},temperature:${temperature}`console.log(`Sending iOTData: ${ioTdata}`);    client.publish('sensor/temperature', ioTdata);}// 连接成功  
client.on('connect', function () {console.log('Connected');setInterval(sendTemperature, 1000);
});// 连接失败  
client.on('error', function (err) {console.log('Connection error: ', err);
});

模拟存储设备接收

import mqtt from 'mqtt'
import * as fs from 'fs'const options = {username:"guest",password:"guest"
}var client = mqtt.connect("mqtt://localhost:1883", options);// 连接成功  
client.on('connect', function () {console.log('Connected');// 订阅主题  client.subscribe('sensor/temperature', function (err) {if (!err) {console.log('Subscribed');}});});// 接收消息  
client.on('message', function (topic, message) {// message is Buffer  console.log(message.toString());recordTemperature(message)//client.end(); // 接收完消息后断开连接  
});// 连接失败  
client.on('error', function (err) {console.log('Connection error: ', err);
});// 连接关闭  
// client.on('close', function () {
//     console.log('Connection closed');
// });function recordTemperature(data){fs.appendFile("./record.txt",data+"\n",(err)=>{if (err) {console.error(err);return;}})
}

后端起服务读取本地信息

import express from 'express'
import * as fs from 'fs'
import cors from 'cors'const app = express();
const port = 5000;app.use(cors());app.get('/v1/iotdataDemo', (req, res) => {let data="";try {data = fs.readFileSync('./record.txt', 'utf8');        } catch (err) {console.error(err);}    if(data.length === 0) return;res.json({ iotData: data.split("\n") });
});app.listen(port, () => {console.log(`Server running on http://localhost:${port}`);
});

前端eChart展示

http://www.yayakq.cn/news/723512/

相关文章:

  • 淘宝网站建设的主图如何设计哈尔滨百度引擎
  • 网上如何建网站职业生涯规划书模板
  • 成都网站制作公司网站会员等级审核功能怎么做
  • 邯郸兄弟建站wordpress进入后台显示500
  • 淘宝客有必须做网站吗网站别人备案怎么办
  • 网站建设-信科网络大连建设信息
  • 精品资源共享课网站建设网站制公司
  • 网站做弹窗广告吗小程序免费制作平台凡科网页版
  • 嘉定建设机械网站百度小说搜索风云榜
  • 沈阳cms建站模板制作作品的软件
  • 长春网站建设哪家专业网页开发者工具
  • 黄骅市有火车站吗中国专业摄影网
  • 公司网站费用湘潭网站开发
  • 如何做设计师个人网站手机邀请函制作软件app
  • 云南工贸网站建设中小型互联网企业有哪些
  • 学校网站建设存在的问题软件应用技术学什么
  • 中英文企业网站系统ui培训设计怎么样
  • 爱站网络科技有限公司建设电商网站的
  • 原创小说手机网站制作需要多少钱运城哪家做网站的公司好
  • 彩票自己开盘做网站深圳网站建设计
  • 单页面零售网站wordpress 上传目录权限设置密码
  • 公司备案证查询网站查询网站o2o电商网站
  • 凡科网怎么修改网站crm客户关系管理系统登录
  • 手机网站开发工具6做ppt设计师哪个网站好
  • 做相亲网站潍坊网页网站制作
  • 怎样申请网站呢wordpress js加载速度
  • 电子商务网站建设需要多少钱网站建设-部署与发布
  • 如何在阿里巴巴做网站现在的建筑模板一般用什么
  • 花钱做的网站本人可以关闭吗wordpress define
  • 湖北现代城市建设集团网站做音乐网站的条件