代码提交
This commit is contained in:
parent
6fc6118904
commit
c4cdef7b3d
|
@ -13,13 +13,13 @@ class mqttHandle {
|
|||
cleanSession: true,
|
||||
connectTimeout: 7000, // 超时时间
|
||||
reconnectPeriod: 7000, // 重连时间间隔
|
||||
host: '175.27.191.156',
|
||||
port: '10083',
|
||||
host: '138.227.111.141',
|
||||
port: '8083',
|
||||
// 认证信息
|
||||
// clientId: Number(new Date()).toString(),
|
||||
clientId: 'mqttjs_23dda38f34',
|
||||
username: "site",
|
||||
password: "site",
|
||||
clientId: 'JBFY',
|
||||
username: "admin",
|
||||
password: "123456",
|
||||
}
|
||||
// this.subscription = {
|
||||
// topic: subscribe, //需要传入数组的包含订阅的名称
|
||||
|
@ -35,7 +35,7 @@ class mqttHandle {
|
|||
//配置链接
|
||||
const { host, port, endpoint, ...options } = this.connect;
|
||||
console.log("this.connect.host", this.connect.host)
|
||||
const connectUrl = 'ws://175.27.191.156:10083/mqtt';
|
||||
const connectUrl = 'ws://138.227.111.141:8083/mqtt';
|
||||
// const connectUrl = `ws://${this.connect.host}:${this.connect.port}`;
|
||||
// if (!client.connected) {
|
||||
// client.on('connect', function () {
|
||||
|
|
|
@ -309,7 +309,7 @@ export default {
|
|||
//mqtt订阅数据
|
||||
createMqtt() {
|
||||
//创建链接,接收数据
|
||||
let topicSends = ["/SC/pub/uwb", "/SC/pub/env"];
|
||||
let topicSends = ["device/publish/FB80"];
|
||||
window.PubScribe(topicSends, this.realInfo);
|
||||
},
|
||||
/** 实时数据分类 */
|
||||
|
@ -317,7 +317,7 @@ export default {
|
|||
let that = this;
|
||||
switch (topic) {
|
||||
// 接收托片
|
||||
case "/SC/pub/uwb":
|
||||
case "device/publish/FB80":
|
||||
try {
|
||||
const utf8decoder = new TextDecoder();
|
||||
const u8arr = new Uint8Array(message);
|
||||
|
|
Loading…
Reference in New Issue