代码提交

This commit is contained in:
lixiaobang 2023-04-14 18:08:20 +08:00
parent 6fc6118904
commit c4cdef7b3d
2 changed files with 8 additions and 8 deletions

View File

@ -13,13 +13,13 @@ class mqttHandle {
cleanSession: true, cleanSession: true,
connectTimeout: 7000, // 超时时间 connectTimeout: 7000, // 超时时间
reconnectPeriod: 7000, // 重连时间间隔 reconnectPeriod: 7000, // 重连时间间隔
host: '175.27.191.156', host: '138.227.111.141',
port: '10083', port: '8083',
// 认证信息 // 认证信息
// clientId: Number(new Date()).toString(), // clientId: Number(new Date()).toString(),
clientId: 'mqttjs_23dda38f34', clientId: 'JBFY',
username: "site", username: "admin",
password: "site", password: "123456",
} }
// this.subscription = { // this.subscription = {
// topic: subscribe, //需要传入数组的包含订阅的名称 // topic: subscribe, //需要传入数组的包含订阅的名称
@ -35,7 +35,7 @@ class mqttHandle {
//配置链接 //配置链接
const { host, port, endpoint, ...options } = this.connect; const { host, port, endpoint, ...options } = this.connect;
console.log("this.connect.host", this.connect.host) 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}`; // const connectUrl = `ws://${this.connect.host}:${this.connect.port}`;
// if (!client.connected) { // if (!client.connected) {
// client.on('connect', function () { // client.on('connect', function () {

View File

@ -309,7 +309,7 @@ export default {
//mqtt //mqtt
createMqtt() { createMqtt() {
// //
let topicSends = ["/SC/pub/uwb", "/SC/pub/env"]; let topicSends = ["device/publish/FB80"];
window.PubScribe(topicSends, this.realInfo); window.PubScribe(topicSends, this.realInfo);
}, },
/** 实时数据分类 */ /** 实时数据分类 */
@ -317,7 +317,7 @@ export default {
let that = this; let that = this;
switch (topic) { switch (topic) {
// //
case "/SC/pub/uwb": case "device/publish/FB80":
try { try {
const utf8decoder = new TextDecoder(); const utf8decoder = new TextDecoder();
const u8arr = new Uint8Array(message); const u8arr = new Uint8Array(message);