TransFlow/node_modules/.cache/babel-loader/294f17ef551dc586b30e2b9671a...

1 line
9.2 KiB
JSON

{"remainingRequest":"D:\\视频边缘1215\\TransFlow\\node_modules\\babel-loader\\lib\\index.js!D:\\视频边缘1215\\TransFlow\\src\\utils\\mqttConfig.js","dependencies":[{"path":"D:\\视频边缘1215\\TransFlow\\src\\utils\\mqttConfig.js","mtime":1673486982994},{"path":"D:\\视频边缘1215\\TransFlow\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1671074740928},{"path":"D:\\视频边缘1215\\TransFlow\\node_modules\\babel-loader\\lib\\index.js","mtime":1671074740599}],"contextDependencies":[],"result":["import _objectWithoutProperties from \"D:/\\u89C6\\u9891\\u8FB9\\u7F181215/TransFlow/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport \"core-js/modules/es6.number.constructor\";\nimport \"core-js/modules/es6.regexp.to-string\";\nimport _classCallCheck from \"D:/\\u89C6\\u9891\\u8FB9\\u7F181215/TransFlow/node_modules/@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"D:/\\u89C6\\u9891\\u8FB9\\u7F181215/TransFlow/node_modules/@babel/runtime/helpers/esm/createClass\";\nimport mqtt from \"mqtt\";\nimport Vue from 'vue';\nvar vm = new Vue();\n\nvar mqttHandle = /*#__PURE__*/function () {\n function mqttHandle(subscribe) {\n _classCallCheck(this, mqttHandle);\n\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 // 认证信息\n clientId: Number(new Date()).toString(),\n username: \"admin\",\n password: \"123456\"\n };\n this.subscription = {\n topic: subscribe,\n //需要传入数组的包含订阅的名称\n qos: 2\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() {\n var _this = this;\n\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\"]); // const connectUrl = `ws://${this.connect.host}:${this.connect.port}${this.connect.endpoint}`;\n\n\n var connectUrl = 'ws://172.16.1.168:10087/';\n\n try {\n this._client = mqtt.connect(connectUrl, options);\n } catch (error) {\n console.log(\"mqtt.connect error\", error);\n }\n\n this._client.on(\"connect\", function () {\n console.log(\"Connection succeeded!\"); // 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\n this._client.on('reconnect', function (error) {\n console.log('正在重连', error);\n });\n\n this._client.on(\"error\", function (error) {\n console.log(\"Connection failed\", error);\n }); //配置topic\n\n\n var _this$subscription = this.subscription,\n topic = _this$subscription.topic,\n qos = _this$subscription.qos;\n\n this._client.subscribe(topic, {\n qos: qos\n }, function (error, res) {\n if (error) {\n console.log(\"Subscribe to topics error\", error);\n return;\n }\n\n _this.subscribeSuccess = true;\n console.log(\"Subscribe to topics res\", res[0].qos, res[0].topic);\n });\n\n this.mqttClient = this._client;\n return this.mqttClient;\n }\n }]);\n\n return mqttHandle;\n}();\n\nexport default mqttHandle;",{"version":3,"sources":["D:/视频边缘1215/TransFlow/src/utils/mqttConfig.js"],"names":["mqtt","Vue","vm","mqttHandle","subscribe","connect","host","mqttHost","port","mqttPort","endpoint","clean","cleanSession","connectTimeout","reconnectPeriod","clientId","Number","Date","toString","username","password","subscription","topic","qos","mqttClient","options","connectUrl","_client","error","console","log","on","res","subscribeSuccess"],"mappings":";;;;;AAAA,OAAOA,IAAP,MAAiB,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AO,CAACC,GAAR,CAAY,uBAAZ,EAD6B,CAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACH,OAVD;;AAWA,WAAKH,OAAL,CAAaI,EAAb,CAAgB,WAAhB,EAA6B,UAACH,KAAD,EAAW;AACpCC,QAAAA,OAAO,CAACC,GAAR,CAAY,MAAZ,EAAoBF,KAApB;AACH,OAFD;;AAGA,WAAKD,OAAL,CAAaI,EAAb,CAAgB,OAAhB,EAAyB,UAACH,KAAD,EAAW;AAChCC,QAAAA,OAAO,CAACC,GAAR,CAAY,mBAAZ,EAAiCF,KAAjC;AACH,OAFD,EAzBY,CA6BZ;;;AA7BY,+BA8BW,KAAKP,YA9BhB;AAAA,UA8BJC,KA9BI,sBA8BJA,KA9BI;AAAA,UA8BGC,GA9BH,sBA8BGA,GA9BH;;AA+BZ,WAAKI,OAAL,CAAavB,SAAb,CAAuBkB,KAAvB,EAA8B;AAAEC,QAAAA,GAAG,EAAEA;AAAP,OAA9B,EAA4C,UAACK,KAAD,EAAQI,GAAR,EAAgB;AACxD,YAAIJ,KAAJ,EAAW;AACPC,UAAAA,OAAO,CAACC,GAAR,CAAY,2BAAZ,EAAyCF,KAAzC;AACA;AACH;;AACD,QAAA,KAAI,CAACK,gBAAL,GAAwB,IAAxB;AACAJ,QAAAA,OAAO,CAACC,GAAR,CAAY,yBAAZ,EAAuCE,GAAG,CAAC,CAAD,CAAH,CAAOT,GAA9C,EAAmDS,GAAG,CAAC,CAAD,CAAH,CAAOV,KAA1D;AACH,OAPD;;AAQA,WAAKE,UAAL,GAAkB,KAAKG,OAAvB;AACA,aAAO,KAAKH,UAAZ;AACH;;;;;;AAGL,eAAerB,UAAf","sourcesContent":["import mqtt from \"mqtt\";\r\nimport Vue from 'vue'\r\nvar vm = new Vue();\r\nclass mqttHandle {\r\n constructor(subscribe) {\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 // 认证信息\r\n clientId: Number(new Date()).toString(),\r\n username: \"admin\",\r\n password: \"123456\",\r\n }\r\n this.subscription = {\r\n topic: subscribe, //需要传入数组的包含订阅的名称\r\n qos: 2,\r\n }\r\n this.mqttClient = null;\r\n }\r\n /**\r\n * 创建链接\r\n * @returns client\r\n */\r\n createConnect() {\r\n //配置链接\r\n const { host, port, endpoint, ...options } = this.connect;\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 try {\r\n this._client = mqtt.connect(connectUrl, options);\r\n \r\n } catch (error) {\r\n console.log(\"mqtt.connect error\", error);\r\n }\r\n this._client.on(\"connect\", () => {\r\n console.log(\"Connection succeeded!\");\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._client.on('reconnect', (error) => {\r\n console.log('正在重连', error)\r\n })\r\n this._client.on(\"error\", (error) => {\r\n console.log(\"Connection failed\", error);\r\n });\r\n \r\n //配置topic\r\n const { topic, qos } = this.subscription;\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 this.mqttClient = this._client;\r\n return this.mqttClient;\r\n }\r\n}\r\n \r\nexport default mqttHandle;"]}]}