TransFlow/node_modules/.cache/babel-loader/e2f8cd4e06cdcb72c970d7412fe...

1 line
12 KiB
JSON

{"remainingRequest":"E:\\视频边缘计算管理平台\\TransFlow\\node_modules\\babel-loader\\lib\\index.js!E:\\视频边缘计算管理平台\\TransFlow\\src\\utils\\mqttConfig.js","dependencies":[{"path":"E:\\视频边缘计算管理平台\\TransFlow\\src\\utils\\mqttConfig.js","mtime":1677026201581},{"path":"E:\\视频边缘计算管理平台\\TransFlow\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\视频边缘计算管理平台\\TransFlow\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import _objectWithoutProperties from \"E:/\\u89C6\\u9891\\u8FB9\\u7F18\\u8BA1\\u7B97\\u7BA1\\u7406\\u5E73\\u53F0/TransFlow/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _classCallCheck from \"E:/\\u89C6\\u9891\\u8FB9\\u7F18\\u8BA1\\u7B97\\u7BA1\\u7406\\u5E73\\u53F0/TransFlow/node_modules/@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"E:/\\u89C6\\u9891\\u8FB9\\u7F18\\u8BA1\\u7B97\\u7BA1\\u7406\\u5E73\\u53F0/TransFlow/node_modules/@babel/runtime/helpers/esm/createClass\";\nimport \"core-js/modules/es6.regexp.split\";\nimport mqtt from \"mqtt\";\nimport Vue from 'vue';\nvar vm = new Vue();\nvar ip = window.location.host.split(\":\")[0];\nconsole.log(\"ip\", ip);\n\nvar mqttHandle = /*#__PURE__*/function () {\n function mqttHandle() {\n _classCallCheck(this, mqttHandle);\n\n var newName = localStorage.getItem('ms_username');\n this.connect = {\n // host: vm.mqttHost,\n // port: vm.mqttPort,\n endpoint: \"/mqtt\",\n clean: true,\n // 保留会话\n cleanSession: true,\n connectTimeout: 7000,\n // 超时时间\n reconnectPeriod: 7000,\n // 重连时间间隔\n host: ip,\n port: '10087',\n // 认证信息\n // clientId: Number(new Date()).toString(),\n clientId: newName,\n username: \"admin\",\n password: \"123456\"\n }; // this.subscription = {\n // topic: subscribe, //需要传入数组的包含订阅的名称\n // qos: 0,\n // }\n\n this.mqttClient = null;\n }\n /**\r\n * 创建链接\r\n * @returns client\r\n */\n\n\n _createClass(mqttHandle, [{\n key: \"createConnect\",\n value: function createConnect(onConnected) {\n //配置链接\n var _this$connect = this.connect,\n host = _this$connect.host,\n port = _this$connect.port,\n endpoint = _this$connect.endpoint,\n options = _objectWithoutProperties(_this$connect, [\"host\", \"port\", \"endpoint\"]);\n\n console.log(\"this.connect.host\", this.connect.host); // const connectUrl = `ws://${this.connect.host}:${this.connect.port}${this.connect.endpoint}`;\n\n var connectUrl = 'ws://172.16.1.168:10087/'; // const connectUrl = `ws://${this.connect.host}:${this.connect.port}`;\n // if (!client.connected) {\n // client.on('connect', function () {\n // console.log('连接成功')\n // })\n // } else {\n // client.publish('test/clientE', ms, {'qos': 2}, function (err) {\n // if (err) {\n // console.log(err)\n // }\n // })\n // }\n\n if (this.mqttClient == undefined) {\n this.mqttClient = mqtt.connect(connectUrl, options);\n this.mqttClient.on(\"connect\", function () {\n console.log(\"Connection succeeded!\");\n onConnected(); // this._client.subscribe('img'+this.number, { qos: 0 });\n // this._client.subscribe('stream'+this.number, { qos: 0 });\n // this._client.subscribe('trajectory'+this.number, { qos: 0 });\n // this._client.subscribe('detection'+this.number, { qos: 0 });\n // this._client.subscribe('img0', { qos: 0 });\n // this._client.subscribe('stream0', { qos: 0 });\n // this._client.subscribe('trajectory0', { qos: 0 });\n // this._client.subscribe('detection0', { qos: 0 });\n });\n this.mqttClient.on('reconnect', function (error) {\n console.log('正在重连');\n });\n this.mqttClient.on(\"error\", function (error) {\n console.log(\"Connection failed\");\n }); //配置topic\n // const { topic, qos } = this.subscription;\n // console.log(topic, qos,'topic, qos');\n // this._client.subscribe(topic, { qos: qos }, (error, res) => {\n // if (error) {\n // console.log(\"Subscribe to topics error\", error);\n // return;\n // }\n // this.subscribeSuccess = true;\n // console.log(\"Subscribe to topics res\", res[0].qos, res[0].topic);\n // });\n }\n\n return this.mqttClient; // try {\n // } catch (error) {\n // console.log(\"mqtt.connect error\", error);\n // }\n }\n }, {\n key: \"MySub\",\n value: function MySub(subscriptions) {\n //['hert','img0','img1','img2','img3','img4','img5','img6','img7']\n this.mqttClient.subscribe(subscriptions, {\n qos: 0\n }, function (err) {\n if (!err) {\n console.log(\"订阅成功:\" + subscriptions);\n } else {\n console.log('消息订阅失败!' + subscriptions);\n }\n });\n }\n }, {\n key: \"MyUnSub\",\n value: function MyUnSub(subscription) {}\n }]);\n\n return mqttHandle;\n}();\n\nexport default mqttHandle;",{"version":3,"sources":["E:/视频边缘计算管理平台/TransFlow/src/utils/mqttConfig.js"],"names":["mqtt","Vue","vm","ip","window","location","host","split","console","log","mqttHandle","newName","localStorage","getItem","connect","endpoint","clean","cleanSession","connectTimeout","reconnectPeriod","port","clientId","username","password","mqttClient","onConnected","options","connectUrl","undefined","on","error","subscriptions","subscribe","qos","err","subscription"],"mappings":";;;;AAAA,OAAOA,IAAP,MAAiB,MAAjB;AACA,OAAOC,GAAP,MAAgB,KAAhB;AACA,IAAIC,EAAE,GAAG,IAAID,GAAJ,EAAT;AACA,IAAIE,EAAE,GAAGC,MAAM,CAACC,QAAP,CAAgBC,IAAhB,CAAqBC,KAArB,CAA2B,GAA3B,EAAgC,CAAhC,CAAT;AACAC,OAAO,CAACC,GAAR,CAAY,IAAZ,EAAiBN,EAAjB;;IACMO,U;AACF,wBAAc;AAAA;;AACV,QAAIC,OAAO,GAAGC,YAAY,CAACC,OAAb,CAAqB,aAArB,CAAd;AACA,SAAKC,OAAL,GAAe;AACX;AACA;AACAC,MAAAA,QAAQ,EAAE,OAHC;AAIXC,MAAAA,KAAK,EAAE,IAJI;AAIE;AACbC,MAAAA,YAAY,EAAE,IALH;AAMXC,MAAAA,cAAc,EAAE,IANL;AAMW;AACtBC,MAAAA,eAAe,EAAE,IAPN;AAOY;AACvBb,MAA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF;;AAED,aAAO,KAAKe,UAAZ,CArDuB,CAuDvB;AAGA;AACA;AACA;AAEH;;;0BAEKO,a,EACN;AACI;AACA,WAAKP,UAAL,CAAgBQ,SAAhB,CAA0BD,aAA1B,EAAyC;AAAEE,QAAAA,GAAG,EAAE;AAAP,OAAzC,EAAqD,UAACC,GAAD,EACrD;AACI,YAAI,CAACA,GAAL,EAAU;AACR1B,UAAAA,OAAO,CAACC,GAAR,CAAY,UAAQsB,aAApB;AAED,SAHD,MAGO;AACLvB,UAAAA,OAAO,CAACC,GAAR,CAAY,YAAUsB,aAAtB;AACD;AACJ,OARD;AASH;;;4BAEOI,Y,EACR,CAEC;;;;;;AAIL,eAAezB,UAAf","sourcesContent":["import mqtt from \"mqtt\";\r\nimport Vue from 'vue'\r\nvar vm = new Vue();\r\nvar ip = window.location.host.split(\":\")[0];\r\nconsole.log(\"ip\",ip)\r\nclass mqttHandle {\r\n constructor() {\r\n var newName = localStorage.getItem('ms_username')\r\n this.connect = {\r\n // host: vm.mqttHost,\r\n // port: vm.mqttPort,\r\n endpoint: \"/mqtt\",\r\n clean: true, // 保留会话\r\n cleanSession: true,\r\n connectTimeout: 7000, // 超时时间\r\n reconnectPeriod: 7000, // 重连时间间隔\r\n host:ip,\r\n port: '10087',\r\n // 认证信息\r\n // clientId: Number(new Date()).toString(),\r\n clientId: newName,\r\n username: \"admin\",\r\n password: \"123456\",\r\n }\r\n // this.subscription = {\r\n // topic: subscribe, //需要传入数组的包含订阅的名称\r\n // qos: 0,\r\n // }\r\n this.mqttClient = null;\r\n }\r\n /**\r\n * 创建链接\r\n * @returns client\r\n */\r\n createConnect(onConnected) {\r\n //配置链接\r\n const { host, port, endpoint, ...options } = this.connect;\r\n console.log(\"this.connect.host\",this.connect.host)\r\n // const connectUrl = `ws://${this.connect.host}:${this.connect.port}${this.connect.endpoint}`;\r\n const connectUrl = 'ws://172.16.1.168:10087/';\r\n // const connectUrl = `ws://${this.connect.host}:${this.connect.port}`;\r\n // if (!client.connected) {\r\n // client.on('connect', function () {\r\n // console.log('连接成功')\r\n // })\r\n // } else {\r\n // client.publish('test/clientE', ms, {'qos': 2}, function (err) {\r\n // if (err) {\r\n // console.log(err)\r\n // }\r\n // })\r\n // }\r\n if (this.mqttClient == undefined)\r\n {\r\n this.mqttClient = mqtt.connect(connectUrl, options);\r\n this.mqttClient.on(\"connect\", () => {\r\n console.log(\"Connection succeeded!\");\r\n onConnected();\r\n // this._client.subscribe('img'+this.number, { qos: 0 });\r\n // this._client.subscribe('stream'+this.number, { qos: 0 });\r\n // this._client.subscribe('trajectory'+this.number, { qos: 0 });\r\n // this._client.subscribe('detection'+this.number, { qos: 0 });\r\n // this._client.subscribe('img0', { qos: 0 });\r\n // this._client.subscribe('stream0', { qos: 0 });\r\n // this._client.subscribe('trajectory0', { qos: 0 });\r\n // this._client.subscribe('detection0', { qos: 0 });\r\n });\r\n this.mqttClient.on('reconnect', (error) => {\r\n console.log('正在重连')\r\n })\r\n this.mqttClient.on(\"error\", (error) => {\r\n console.log(\"Connection failed\");\r\n });\r\n \r\n //配置topic\r\n // const { topic, qos } = this.subscription;\r\n // console.log(topic, qos,'topic, qos');\r\n // this._client.subscribe(topic, { qos: qos }, (error, res) => {\r\n // if (error) {\r\n // console.log(\"Subscribe to topics error\", error);\r\n // return;\r\n // }\r\n // this.subscribeSuccess = true;\r\n // console.log(\"Subscribe to topics res\", res[0].qos, res[0].topic);\r\n // });\r\n }\r\n\r\n return this.mqttClient;\r\n \r\n // try {\r\n \r\n \r\n // } catch (error) {\r\n // console.log(\"mqtt.connect error\", error);\r\n // }\r\n \r\n }\r\n\r\n MySub(subscriptions)\r\n {\r\n //['hert','img0','img1','img2','img3','img4','img5','img6','img7']\r\n this.mqttClient.subscribe(subscriptions, { qos: 0 }, (err)=>\r\n {\r\n if (!err) {\r\n console.log(\"订阅成功:\"+subscriptions);\r\n \r\n } else {\r\n console.log('消息订阅失败!'+subscriptions)\r\n }\r\n });\r\n }\r\n\r\n MyUnSub(subscription)\r\n {\r\n\r\n }\r\n\r\n\r\n}\r\nexport default mqttHandle;"]}]}