1 line
155 KiB
JavaScript
1 line
155 KiB
JavaScript
|
(self["webpackChunkset_vue"]=self["webpackChunkset_vue"]||[]).push([[149],{5149:function(t,e,r){r(4114),r(6573),r(8100),r(7936),r(7467),r(4732),r(9577),r(9848),function(e){t.exports=e()}((function(){var t;return function(){function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){var u=void 0;if(!a&&u)return require(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};e[s][0].call(l.exports,(function(t){var r=e[s][1][t];return i(r||t)}),l,l.exports,t,e,r,n)}return r[s].exports}for(var o=void 0,s=0;s<n.length;s++)i(n[s]);return i}return t}()({1:[function(t,e,n){(function(r,n){"use strict";var i=t("events"),o=t("./store"),s=t("end-of-stream"),a=t("mqtt-packet"),u=t("readable-stream").Writable,c=t("inherits"),l=t("reinterval"),f=t("./validations"),h=t("xtend"),p=n.setImmediate||function(t){r.nextTick(t)},d={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0};function g(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function y(t,e,r){t.emit("packetsend",e);var n=a.writeToStream(e,t.stream);!n&&r?t.stream.once("drain",r):r&&r()}function b(t){t&&Object.keys(t).forEach((function(e){"function"===typeof t[e]&&(t[e](new Error("Connection closed")),delete t[e])}))}function _(t,e,r){t.outgoingStore.put(e,(function(n){if(n)return r&&r(n);y(t,e,r)}))}function m(){}function v(t,e){var r,n=this;if(!(this instanceof v))return new v(t,e);for(r in this.options=e||{},d)"undefined"===typeof this.options[r]?this.options[r]=d[r]:this.options[r]=e[r];this.options.clientId="string"===typeof this.options.clientId?this.options.clientId:g(),this.streamBuilder=t,this.outgoingStore=this.options.outgoingStore||new o,this.incomingStore=this.options.incomingStore||new o,this.queueQoSZero=void 0===this.options.queueQoSZero||this.options.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this.on("connect",(function(){if(!this.disconnected){this.connected=!0;var t=this.outgoingStore.createStream();this.once("close",e),t.on("end",(function(){n.removeListener("close",e)})),t.on("error",(function(t){n.removeListener("close",e),n.emit("error",t)})),r()}function e(){t.destroy(),t=null}function r(){if(t){var e,i=t.read(1);i?n.disconnecting||n.reconnectTimer?t.destroy&&t.destroy():(e=n.outgoing[i.messageId],n.outgoing[i.messageId]=function(t,n){e&&e(t,n),r()},n._sendPacket(i)):t.once("readable",r)}}})),this.on("close",(function(){this.connected=!1,clearTimeout(this.connackTimer)})),this.on("connect",this._setupPingTimer),this.on("connect",(function(){var t=this.queue;function e(){var r=t.shift(),i=null;r&&(i=r.packet,n._sendPacket(i,(function(t){r.cb&&r.cb(t),e()})))}e()}));var s=!0;this.on("connect",(function(){!s&&this.options.clean&&Object.keys(this._resubscribeTopics).length>0&&(this.options.resubscribe?(this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics)):this._resubscribeTopics={}),s=!1})),this.on("close",(function(){null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null)})),this.on("close",this._setupReconnect),i.EventEmitter.call(this),this._setupStream()}c(v,i.EventEmitter),v.prototype._setupStream=function(){var t,e=this,n=new u,i=a.parser(this.options),o=null,c=[];function l(){r.nextTick(f)}function f(){var t=c.shift(),r=o;t?e._handlePacket(t,l):(o=null,r())}this._clearReconnect(),this.stream=this.streamBuilder(this),i.on("packet",(function(t){c.push(t)})),n._write=function(t,e,r){o=r,i.parse(t),f()},this.stream.pipe(n),this.stream.on("error",m),s(this.stream,this.emit.bind(this,"close")),t=Object.create(this.options),t.cmd="connect",y(this,t),i.on("error",this.emit.bind(this,"error")),this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){e._cleanUp(!0)}),this.options.connectTimeout)},v.prototype._handlePa
|