diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..008c1ff --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,311 @@ +{ + "name": "APP-main", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.9.0.tgz", + "integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cordova-sqlite-storage": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-7.0.0.tgz", + "integrity": "sha512-BV1KCNtHnFD37ZQmhztStKsaNxniGlLcUSiQ9wieWH2PpZ0gH/tuWeINrrXGKIt9teTukYRnxFyerQ/Lc9x41A==", + "dependencies": { + "cordova-sqlite-storage-dependencies": "5.0.0" + } + }, + "node_modules/cordova-sqlite-storage-dependencies": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cordova-sqlite-storage-dependencies/-/cordova-sqlite-storage-dependencies-5.0.0.tgz", + "integrity": "sha512-WjWm1QX+2JyLxjaNmYX2kNzmhrRk8q6n4GQ1PkUc79xR2bmJeO/m3koSuPemnWJdLdlsqDz8dCEHmgQSxhYjcg==" + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz", + "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/paho-mqtt": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/paho-mqtt/-/paho-mqtt-1.1.0.tgz", + "integrity": "sha512-KPbL9KAB0ASvhSDbOrZBaccXS+/s7/LIofbPyERww8hM5Ko71GUJQ6Nmg0BWqj8phAIT8zdf/Sd/RftHU9i2HA==", + "license": "EPL-1.0" + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/text-encoding": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.7.0.tgz", + "integrity": "sha512-oJQ3f1hrOnbRLOcwKz0Liq2IcrvDeZRHXhd9RgLrsT+DjWY/nty1Hi7v3dtkaEYbPYe0mUoOfzRrMwfXXwgPUA==", + "deprecated": "no longer maintained" + }, + "node_modules/vk-uview-ui": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/vk-uview-ui/-/vk-uview-ui-1.5.2.tgz", + "integrity": "sha512-RRZgiEAc8qaUerSi7lSbrkCoLBgRUwFQHwP1V44pJO7Js+7HeHFEkkpPrtkOi14hl4CntR4qIhIDvaKmIJqVsw==", + "engines": { + "HBuilderX": "^3.1.0" + } + } + } +} diff --git a/node_modules/paho-mqtt/.npm/_cacache/index-v5/42/e8/733f84666bf8ae51438746731476ab9b2f309ff6f8ebeda2a8ff3fe11009 b/node_modules/paho-mqtt/.npm/_cacache/index-v5/42/e8/733f84666bf8ae51438746731476ab9b2f309ff6f8ebeda2a8ff3fe11009 new file mode 100644 index 0000000..3331d71 --- /dev/null +++ b/node_modules/paho-mqtt/.npm/_cacache/index-v5/42/e8/733f84666bf8ae51438746731476ab9b2f309ff6f8ebeda2a8ff3fe11009 @@ -0,0 +1,2 @@ + +ee3f3ed558ef2238c94265495ea3b8bb50a47e26 {"key":"make-fetch-happen:request-cache:https://registry.npmjs.org/-/v1/login","integrity":null,"time":1542887192495} \ No newline at end of file diff --git a/node_modules/paho-mqtt/.npm/_cacache/index-v5/b1/39/f91af860e5eb9058d952996c11e90a1562eb56cad7626fc0934b688247da b/node_modules/paho-mqtt/.npm/_cacache/index-v5/b1/39/f91af860e5eb9058d952996c11e90a1562eb56cad7626fc0934b688247da new file mode 100644 index 0000000..cf9fb6b --- /dev/null +++ b/node_modules/paho-mqtt/.npm/_cacache/index-v5/b1/39/f91af860e5eb9058d952996c11e90a1562eb56cad7626fc0934b688247da @@ -0,0 +1,2 @@ + +b956bf3f77cdaa5f7fb17a650168422dd0676fbc {"key":"make-fetch-happen:request-cache:https://registry.npmjs.org/-/user/org.couchdb.user:jpwsutton","integrity":null,"time":1542887232403} \ No newline at end of file diff --git a/node_modules/paho-mqtt/.npm/_logs/2018-11-22T11_46_27_151Z-debug.log b/node_modules/paho-mqtt/.npm/_logs/2018-11-22T11_46_27_151Z-debug.log new file mode 100644 index 0000000..7f5e019 --- /dev/null +++ b/node_modules/paho-mqtt/.npm/_logs/2018-11-22T11_46_27_151Z-debug.log @@ -0,0 +1,78 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/local/Cellar/node/10.7.0/bin/node', +1 verbose cli '/usr/local/bin/npm', +1 verbose cli 'publish' ] +2 info using npm@6.4.1 +3 info using node@v10.7.0 +4 verbose npm-session d96c0348a547f465 +5 verbose publish [ '.' ] +6 info lifecycle paho-mqtt@1.1.0~prepublish: paho-mqtt@1.1.0 +7 info lifecycle paho-mqtt@1.1.0~prepare: paho-mqtt@1.1.0 +8 info lifecycle paho-mqtt@1.1.0~prepublishOnly: paho-mqtt@1.1.0 +9 info lifecycle paho-mqtt@1.1.0~prepack: paho-mqtt@1.1.0 +10 info lifecycle paho-mqtt@1.1.0~postpack: paho-mqtt@1.1.0 +11 notice +12 notice 📦 paho-mqtt@1.1.0 +13 notice === Tarball Contents === +14 notice 606B package.json +14 notice 1.6kB about.html +14 notice 3.7kB CONTRIBUTING.md +14 notice 1.6kB edl-v10 +14 notice 11.2kB epl-v10 +14 notice 32.2kB paho-mqtt-min.js +14 notice 90.3kB paho-mqtt.js +14 notice 4.7kB README.md +15 notice === Tarball Details === +16 notice name: paho-mqtt +16 notice version: 1.1.0 +16 notice package size: 37.2 kB +16 notice unpacked size: 145.9 kB +16 notice shasum: 140ae65f16b20f8622e6c68aac5774ea0b3609a3 +16 notice integrity: sha512-pRr2lCE2FciFP[...]B4f0UEsZJ594Q== +16 notice total files: 8 +17 notice +18 verbose getPublishConfig undefined +19 silly mapToRegistry name paho-mqtt +20 silly mapToRegistry using default registry +21 silly mapToRegistry registry https://registry.npmjs.org/ +22 silly mapToRegistry data { type: 'tag', +22 silly mapToRegistry registry: true, +22 silly mapToRegistry where: undefined, +22 silly mapToRegistry raw: 'paho-mqtt', +22 silly mapToRegistry name: 'paho-mqtt', +22 silly mapToRegistry escapedName: 'paho-mqtt', +22 silly mapToRegistry scope: undefined, +22 silly mapToRegistry rawSpec: '', +22 silly mapToRegistry saveSpec: null, +22 silly mapToRegistry fetchSpec: 'latest', +22 silly mapToRegistry gitRange: undefined, +22 silly mapToRegistry gitCommittish: undefined, +22 silly mapToRegistry hosted: undefined } +23 silly mapToRegistry uri https://registry.npmjs.org/paho-mqtt +24 verbose publish registryBase https://registry.npmjs.org/ +25 silly publish uploading /var/folders/r7/47tnp9g16794rt7ff63tp2500000gn/T/npm-95867-c4ec80c4/tmp/fromDir-9f1696dc/package.tgz +26 verbose stack Error: auth required for publishing +26 verbose stack at RegClient.publish (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/publish.js:30:14) +26 verbose stack at BB.fromNode (/usr/local/lib/node_modules/npm/lib/publish.js:187:16) +26 verbose stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) +26 verbose stack at Function.Promise.fromNode.Promise.fromCallback (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:180:30) +26 verbose stack at BB.fromNode.spread (/usr/local/lib/node_modules/npm/lib/publish.js:186:15) +26 verbose stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) +26 verbose stack at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:509:35) +26 verbose stack at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18) +26 verbose stack at Promise._settlePromiseCtx (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:606:10) +26 verbose stack at Async._drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12) +26 verbose stack at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10) +26 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14) +26 verbose stack at runCallback (timers.js:696:18) +26 verbose stack at tryOnImmediate (timers.js:667:5) +26 verbose stack at processImmediate (timers.js:649:5) +27 verbose cwd /Users/jsutton/ibm/paho/git/npm/node_modules/paho-mqtt +28 verbose Darwin 18.2.0 +29 verbose argv "/usr/local/Cellar/node/10.7.0/bin/node" "/usr/local/bin/npm" "publish" +30 verbose node v10.7.0 +31 verbose npm v6.4.1 +32 error code ENEEDAUTH +33 error need auth auth required for publishing +34 error need auth You need to authorize this machine using `npm adduser` +35 verbose exit [ 1, true ] diff --git a/node_modules/paho-mqtt/README.md b/node_modules/paho-mqtt/README.md new file mode 100644 index 0000000..1a187b5 --- /dev/null +++ b/node_modules/paho-mqtt/README.md @@ -0,0 +1,107 @@ +# Eclipse Paho JavaScript client + +The Paho JavaScript Client is an MQTT browser-based client library written in Javascript that uses WebSockets to connect to an MQTT Broker. + +## Project description: + +The Paho project has been created to provide reliable open-source implementations of open and standard messaging protocols aimed at new, existing, and emerging applications for Machine-to-Machine (M2M) and Internet of Things (IoT). +Paho reflects the inherent physical and cost constraints of device connectivity. Its objectives include effective levels of decoupling between devices and applications, designed to keep markets open and encourage the rapid growth of scalable Web and Enterprise middleware and applications. + +## Links + +- Project Website: [https://www.eclipse.org/paho](https://www.eclipse.org/paho) +- Eclipse Project Information: [https://projects.eclipse.org/projects/iot.paho](https://projects.eclipse.org/projects/iot.paho) +- Paho Javascript Client Page: [https://eclipse.org/paho/clients/js/](https://eclipse.org/paho/clients/js) +- GitHub: [https://github.com/eclipse/paho.mqtt.javascript](https://github.com/eclipse/paho.mqtt.javascript) +- Twitter: [@eclipsepaho](https://twitter.com/eclipsepaho) +- Issues: [github.com/eclipse/paho.mqtt.javascript/issues](https://github.com/eclipse/paho.mqtt.javascript/issues) +- Mailing-list: [https://dev.eclipse.org/mailman/listinfo/paho-dev](https://dev.eclipse.org/mailman/listinfo/paho-dev + + +## Using the Paho Javascript Client + + +### Downloading + +A zip file containing the full and a minified version the Javascript client can be downloaded from the [Paho downloads page](https://projects.eclipse.org/projects/technology.paho/downloads) + +Alternatively the Javascript client can be downloaded directly from the projects git repository: [https://raw.githubusercontent.com/eclipse/paho.mqtt.javascript/master/src/paho-mqtt.js](https://raw.githubusercontent.com/eclipse/paho.mqtt.javascript/master/src/paho-mqtt.js). + +Please **do not** link directly to this url from your application. + +### Building from source + +There are two active branches on the Paho Java git repository, ```master``` which is used to produce stable releases, and ```develop``` where active development is carried out. By default cloning the git repository will download the ```master``` branch, to build from develop make sure you switch to the remote branch: ```git checkout -b develop remotes/origin/develop``` + +The project contains a maven based build that produces a minified version of the client, runs unit tests and generates it's documentation. + +To run the build: + +``` +$ mvn +``` + +The output of the build is copied to the ```target``` directory. + +### Tests + +The client uses the [Jasmine](http://jasmine.github.io/) test framework. The tests for the client are in: + +``` +src/tests +``` + +To run the tests with maven, use the following command: +``` +$ mvn test +``` +The parameters passed in should be modified to match the broker instance being tested against. + +### Documentation + +Reference documentation is online at: [http://www.eclipse.org/paho/files/jsdoc/index.html](http://www.eclipse.org/paho/files/jsdoc/index.html) + +### Compatibility + +The client should work in any browser fully supporting WebSockets, [http://caniuse.com/websockets](http://caniuse.com/websockets) lists browser compatibility. + +## Getting Started + +The included code below is a very basic sample that connects to a server using WebSockets and subscribes to the topic ```World```, once subscribed, it then publishes the message ```Hello``` to that topic. Any messages that come into the subscribed topic will be printed to the Javascript console. + +This requires the use of a broker that supports WebSockets natively, or the use of a gateway that can forward between WebSockets and TCP. + +```JS +// Create a client instance +client = new Paho.MQTT.Client(location.hostname, Number(location.port), "clientId"); + +// set callback handlers +client.onConnectionLost = onConnectionLost; +client.onMessageArrived = onMessageArrived; + +// connect the client +client.connect({onSuccess:onConnect}); + + +// called when the client connects +function onConnect() { + // Once a connection has been made, make a subscription and send a message. + console.log("onConnect"); + client.subscribe("World"); + message = new Paho.MQTT.Message("Hello"); + message.destinationName = "World"; + client.send(message); +} + +// called when the client loses its connection +function onConnectionLost(responseObject) { + if (responseObject.errorCode !== 0) { + console.log("onConnectionLost:"+responseObject.errorMessage); + } +} + +// called when a message arrives +function onMessageArrived(message) { + console.log("onMessageArrived:"+message.payloadString); +} +``` diff --git a/node_modules/paho-mqtt/about.html b/node_modules/paho-mqtt/about.html new file mode 100644 index 0000000..6555a44 --- /dev/null +++ b/node_modules/paho-mqtt/about.html @@ -0,0 +1,28 @@ + +
+ +December 9, 2013
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL") and Eclipse Distribution License Version 1.0 ("EDL"). +A copy of the EPL is available at +http://www.eclipse.org/legal/epl-v10.html +and a copy of the EDL is available at +http://www.eclipse.org/org/documents/edl-v10.php. +For purposes of the EPL, "Program" will mean the Content.
+ +If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.
+ + diff --git a/node_modules/paho-mqtt/edl-v10 b/node_modules/paho-mqtt/edl-v10 new file mode 100644 index 0000000..cf989f1 --- /dev/null +++ b/node_modules/paho-mqtt/edl-v10 @@ -0,0 +1,15 @@ + +Eclipse Distribution License - v 1.0 + +Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/node_modules/paho-mqtt/epl-v10 b/node_modules/paho-mqtt/epl-v10 new file mode 100644 index 0000000..79e486c --- /dev/null +++ b/node_modules/paho-mqtt/epl-v10 @@ -0,0 +1,70 @@ +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: +i) changes to the Program, and +ii) additions to the Program; +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and +b) its license agreement: +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and +b) a copy of this Agreement must be included with each copy of the Program. +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. diff --git a/node_modules/paho-mqtt/package.json b/node_modules/paho-mqtt/package.json new file mode 100644 index 0000000..3e667ff --- /dev/null +++ b/node_modules/paho-mqtt/package.json @@ -0,0 +1,26 @@ +{ + "name": "paho-mqtt", + "version": "1.1.0", + "description": "Eclipse Paho JavaScript MQTT client for Browsers", + "main": "paho-mqtt.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/eclipse/paho.mqtt.javascript.git" + }, + "keywords": [ + "mqtt", + "paho", + "eclipse", + "iot", + "m2m" + ], + "author": "Andrew Banks (Initial Author)", + "license": "EPL-1.0", + "bugs": { + "url": "https://github.com/eclipse/paho.mqtt.javascript/issues" + }, + "homepage": "https://github.com/eclipse/paho.mqtt.javascript#readme" +} diff --git a/node_modules/paho-mqtt/paho-mqtt-min.js b/node_modules/paho-mqtt/paho-mqtt-min.js new file mode 100644 index 0000000..c24e9b7 --- /dev/null +++ b/node_modules/paho-mqtt/paho-mqtt-min.js @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2013, 2016 IBM Corp. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + *******************************************************************************/ +(function(t,q){"object"===typeof exports&&"object"===typeof module?module.exports=q():"function"===typeof define&&define.amd?define(q):"object"===typeof exports?exports=q():t.Paho=q()})(this,function(){return function(t){function q(a,b,c){b[c++]=a>>8;b[c++]=a%256;return c}function r(a,b,c,k){k=q(b,c,k);E(a,c,k);return k+b}function n(a){for(var b=0,c=0;c+ * This programming interface lets a JavaScript client application use the MQTT V3.1 or + * V3.1.1 protocol to connect to an MQTT-supporting messaging server. + * + * The function supported includes: + *
+ * The API consists of two main objects: + *
+ * The programming interface validates parameters passed to it, and will throw + * an Error containing an error message intended for developer use, if it detects + * an error with any parameter. + *
+ * Example:
+ *
+ *
+ * The send, subscribe and unsubscribe methods are implemented as asynchronous JavaScript methods
+ * (even though the underlying protocol exchange might be synchronous in nature).
+ * This means they signal their completion by calling back to the application,
+ * via Success or Failure callback functions provided by the application on the method in question.
+ * Such callbacks are called at most once per method invocation and do not persist beyond the lifetime
+ * of the script that made the invocation.
+ *
+ * In contrast there are some callback functions, most notably onMessageArrived,
+ * that are defined on the {@link Paho.Client} object.
+ * These may get called multiple times, and aren't directly related to specific method invocations made by the client.
+ *
+ * @name Paho.Client
+ *
+ * @constructor
+ *
+ * @param {string} host - the address of the messaging server, as a fully qualified WebSocket URI, as a DNS name or dotted decimal IP address.
+ * @param {number} port - the port number to connect to - only required if host is not a URI
+ * @param {string} path - the path on the host to connect to - only used if host is not a URI. Default: '/mqtt'.
+ * @param {string} clientId - the Messaging client identifier, between 1 and 23 characters in length.
+ *
+ * @property {string} host - read only the server's DNS hostname or dotted decimal IP address.
+ * @property {number} port - read only the server's port.
+ * @property {string} path - read only the server's path.
+ * @property {string} clientId - read only used when connecting to the server.
+ * @property {function} onConnectionLost - called when a connection has been lost.
+ * after a connect() method has succeeded.
+ * Establish the call back used when a connection has been lost. The connection may be
+ * lost because the client initiates a disconnect or because the server or network
+ * cause the client to be disconnected. The disconnect call back may be called without
+ * the connectionComplete call back being invoked if, for example the client fails to
+ * connect.
+ * A single response object parameter is passed to the onConnectionLost callback containing the following fields:
+ *
+ * All attributes may be null, which implies the default values.
+ *
+ * @name Paho.Message
+ * @constructor
+ * @param {String|ArrayBuffer} payload The message data to be sent.
+ *
+ * @property {string} payloadString read only The payload as a string if the payload consists of valid UTF-8 characters.
+ * @property {ArrayBuffer} payloadBytes read only The payload as an ArrayBuffer.
+ *
+ * @property {string} destinationName mandatory The name of the destination to which the message is to be sent
+ * (for messages about to be sent) or the name of the destination from which the message has been received.
+ * (for messages received by the onMessage function).
+ *
+ * @property {number} qos The Quality of Service used to deliver the message.
+ *
+ * @property {Boolean} retained If true, the message is to be retained by the server and delivered
+ * to both current and future subscriptions.
+ * If false the server only delivers the message to current subscribers, this is the default for new Messages.
+ * A received message has the retained boolean set to true if the message was published
+ * with the retained boolean set to true
+ * and the subscrption was made after the message has been published.
+ *
+ * @property {Boolean} duplicate read only If true, this message might be a duplicate of one which has already been received.
+ * This is only set on messages received from the server.
+ *
+ */
+ var Message = function (newPayload) {
+ var payload;
+ if ( typeof newPayload === "string" ||
+ newPayload instanceof ArrayBuffer ||
+ (ArrayBuffer.isView(newPayload) && !(newPayload instanceof DataView))
+ ) {
+ payload = newPayload;
+ } else {
+ throw (format(ERROR.INVALID_ARGUMENT, [newPayload, "newPayload"]));
+ }
+
+ var destinationName;
+ var qos = 0;
+ var retained = false;
+ var duplicate = false;
+
+ Object.defineProperties(this,{
+ "payloadString":{
+ enumerable : true,
+ get : function () {
+ if (typeof payload === "string")
+ return payload;
+ else
+ return parseUTF8(payload, 0, payload.length);
+ }
+ },
+ "payloadBytes":{
+ enumerable: true,
+ get: function() {
+ if (typeof payload === "string") {
+ var buffer = new ArrayBuffer(UTF8Length(payload));
+ var byteStream = new Uint8Array(buffer);
+ stringToUTF8(payload, byteStream, 0);
+
+ return byteStream;
+ } else {
+ return payload;
+ }
+ }
+ },
+ "destinationName":{
+ enumerable: true,
+ get: function() { return destinationName; },
+ set: function(newDestinationName) {
+ if (typeof newDestinationName === "string")
+ destinationName = newDestinationName;
+ else
+ throw new Error(format(ERROR.INVALID_ARGUMENT, [newDestinationName, "newDestinationName"]));
+ }
+ },
+ "qos":{
+ enumerable: true,
+ get: function() { return qos; },
+ set: function(newQos) {
+ if (newQos === 0 || newQos === 1 || newQos === 2 )
+ qos = newQos;
+ else
+ throw new Error("Invalid argument:"+newQos);
+ }
+ },
+ "retained":{
+ enumerable: true,
+ get: function() { return retained; },
+ set: function(newRetained) {
+ if (typeof newRetained === "boolean")
+ retained = newRetained;
+ else
+ throw new Error(format(ERROR.INVALID_ARGUMENT, [newRetained, "newRetained"]));
+ }
+ },
+ "topic":{
+ enumerable: true,
+ get: function() { return destinationName; },
+ set: function(newTopic) {destinationName=newTopic;}
+ },
+ "duplicate":{
+ enumerable: true,
+ get: function() { return duplicate; },
+ set: function(newDuplicate) {duplicate=newDuplicate;}
+ }
+ });
+ };
+
+ // Module contents.
+ return {
+ Client: Client,
+ Message: Message
+ };
+ // eslint-disable-next-line no-nested-ternary
+ })(typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
+ return PahoMQTT;
+});
diff --git a/pages/650/HBY650.vue b/pages/650/HBY650.vue
index b39c443..a9a1891 100644
--- a/pages/650/HBY650.vue
+++ b/pages/650/HBY650.vue
@@ -22,10 +22,10 @@
+ * @namespace Paho
+ */
+
+/* jshint shadow:true */
+(function ExportLibrary(root, factory) {
+ if(typeof exports === "object" && typeof module === "object"){
+ module.exports = factory();
+ } else if (typeof define === "function" && define.amd){
+ define(factory);
+ } else if (typeof exports === "object"){
+ exports = factory();
+ } else {
+ //if (typeof root.Paho === "undefined"){
+ // root.Paho = {};
+ //}
+ root.Paho = factory();
+ }
+})(this, function LibraryFactory(){
+
+
+ var PahoMQTT = (function (global) {
+
+ // Private variables below, these are only visible inside the function closure
+ // which is used to define the module.
+ var version = "@VERSION@-@BUILDLEVEL@";
+
+ /**
+ * @private
+ */
+ var localStorage = global.localStorage || (function () {
+ var data = {};
+
+ return {
+ setItem: function (key, item) { data[key] = item; },
+ getItem: function (key) { return data[key]; },
+ removeItem: function (key) { delete data[key]; },
+ };
+ })();
+
+ /**
+ * Unique message type identifiers, with associated
+ * associated integer values.
+ * @private
+ */
+ var MESSAGE_TYPE = {
+ CONNECT: 1,
+ CONNACK: 2,
+ PUBLISH: 3,
+ PUBACK: 4,
+ PUBREC: 5,
+ PUBREL: 6,
+ PUBCOMP: 7,
+ SUBSCRIBE: 8,
+ SUBACK: 9,
+ UNSUBSCRIBE: 10,
+ UNSUBACK: 11,
+ PINGREQ: 12,
+ PINGRESP: 13,
+ DISCONNECT: 14
+ };
+
+ // Collection of utility methods used to simplify module code
+ // and promote the DRY pattern.
+
+ /**
+ * Validate an object's parameter names to ensure they
+ * match a list of expected variables name for this option
+ * type. Used to ensure option object passed into the API don't
+ * contain erroneous parameters.
+ * @param {Object} obj - User options object
+ * @param {Object} keys - valid keys and types that may exist in obj.
+ * @throws {Error} Invalid option parameter found.
+ * @private
+ */
+ var validate = function(obj, keys) {
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ if (keys.hasOwnProperty(key)) {
+ if (typeof obj[key] !== keys[key])
+ throw new Error(format(ERROR.INVALID_TYPE, [typeof obj[key], key]));
+ } else {
+ var errorStr = "Unknown property, " + key + ". Valid properties are:";
+ for (var validKey in keys)
+ if (keys.hasOwnProperty(validKey))
+ errorStr = errorStr+" "+validKey;
+ throw new Error(errorStr);
+ }
+ }
+ }
+ };
+
+ /**
+ * Return a new function which runs the user function bound
+ * to a fixed scope.
+ * @param {function} User function
+ * @param {object} Function scope
+ * @return {function} User function bound to another scope
+ * @private
+ */
+ var scope = function (f, scope) {
+ return function () {
+ return f.apply(scope, arguments);
+ };
+ };
+
+ /**
+ * Unique message type identifiers, with associated
+ * associated integer values.
+ * @private
+ */
+ var ERROR = {
+ OK: {code:0, text:"AMQJSC0000I OK."},
+ CONNECT_TIMEOUT: {code:1, text:"AMQJSC0001E Connect timed out."},
+ SUBSCRIBE_TIMEOUT: {code:2, text:"AMQJS0002E Subscribe timed out."},
+ UNSUBSCRIBE_TIMEOUT: {code:3, text:"AMQJS0003E Unsubscribe timed out."},
+ PING_TIMEOUT: {code:4, text:"AMQJS0004E Ping timed out."},
+ INTERNAL_ERROR: {code:5, text:"AMQJS0005E Internal error. Error Message: {0}, Stack trace: {1}"},
+ CONNACK_RETURNCODE: {code:6, text:"AMQJS0006E Bad Connack return code:{0} {1}."},
+ SOCKET_ERROR: {code:7, text:"AMQJS0007E Socket error:{0}."},
+ SOCKET_CLOSE: {code:8, text:"AMQJS0008I Socket closed."},
+ MALFORMED_UTF: {code:9, text:"AMQJS0009E Malformed UTF data:{0} {1} {2}."},
+ UNSUPPORTED: {code:10, text:"AMQJS0010E {0} is not supported by this browser."},
+ INVALID_STATE: {code:11, text:"AMQJS0011E Invalid state {0}."},
+ INVALID_TYPE: {code:12, text:"AMQJS0012E Invalid type {0} for {1}."},
+ INVALID_ARGUMENT: {code:13, text:"AMQJS0013E Invalid argument {0} for {1}."},
+ UNSUPPORTED_OPERATION: {code:14, text:"AMQJS0014E Unsupported operation."},
+ INVALID_STORED_DATA: {code:15, text:"AMQJS0015E Invalid data in local storage key={0} value={1}."},
+ INVALID_MQTT_MESSAGE_TYPE: {code:16, text:"AMQJS0016E Invalid MQTT message type {0}."},
+ MALFORMED_UNICODE: {code:17, text:"AMQJS0017E Malformed Unicode string:{0} {1}."},
+ BUFFER_FULL: {code:18, text:"AMQJS0018E Message buffer is full, maximum buffer size: {0}."},
+ };
+
+ /** CONNACK RC Meaning. */
+ var CONNACK_RC = {
+ 0:"Connection Accepted",
+ 1:"Connection Refused: unacceptable protocol version",
+ 2:"Connection Refused: identifier rejected",
+ 3:"Connection Refused: server unavailable",
+ 4:"Connection Refused: bad user name or password",
+ 5:"Connection Refused: not authorized"
+ };
+
+ /**
+ * Format an error message text.
+ * @private
+ * @param {error} ERROR value above.
+ * @param {substitutions} [array] substituted into the text.
+ * @return the text with the substitutions made.
+ */
+ var format = function(error, substitutions) {
+ var text = error.text;
+ if (substitutions) {
+ var field,start;
+ for (var i=0; i
+var client = new Paho.MQTT.Client(location.hostname, Number(location.port), "clientId");
+client.onConnectionLost = onConnectionLost;
+client.onMessageArrived = onMessageArrived;
+client.connect({onSuccess:onConnect});
+
+function onConnect() {
+ // Once a connection has been made, make a subscription and send a message.
+ console.log("onConnect");
+ client.subscribe("/World");
+ var message = new Paho.MQTT.Message("Hello");
+ message.destinationName = "/World";
+ client.send(message);
+};
+function onConnectionLost(responseObject) {
+ if (responseObject.errorCode !== 0)
+ console.log("onConnectionLost:"+responseObject.errorMessage);
+};
+function onMessageArrived(message) {
+ console.log("onMessageArrived:"+message.payloadString);
+ client.disconnect();
+};
+ *
+ *
+ * @property {function} onMessageDelivered - called when a message has been delivered.
+ * All processing that this Client will ever do has been completed. So, for example,
+ * in the case of a Qos=2 message sent by this client, the PubComp flow has been received from the server
+ * and the message has been removed from persistent storage before this callback is invoked.
+ * Parameters passed to the onMessageDelivered callback are:
+ *
+ *
+ * @property {function} onMessageArrived - called when a message has arrived in this Paho.client.
+ * Parameters passed to the onMessageArrived callback are:
+ *
+ *
+ * @property {function} onConnected - called when a connection is successfully made to the server.
+ * after a connect() method.
+ * Parameters passed to the onConnected callback are:
+ *
+ *
+ * @property {boolean} disconnectedPublishing - if set, will enable disconnected publishing in
+ * in the event that the connection to the server is lost.
+ * @property {number} disconnectedBufferSize - Used to set the maximum number of messages that the disconnected
+ * buffer will hold before rejecting new messages. Default size: 5000 messages
+ * @property {function} trace - called whenever trace is called. TODO
+ */
+ var Client = function (host, port, path, clientId) {
+
+ var uri;
+
+ if (typeof host !== "string")
+ throw new Error(format(ERROR.INVALID_TYPE, [typeof host, "host"]));
+
+ if (arguments.length == 2) {
+ // host: must be full ws:// uri
+ // port: clientId
+ clientId = port;
+ uri = host;
+ var match = uri.match(/^(wss?):\/\/((\[(.+)\])|([^\/]+?))(:(\d+))?(\/.*)$/);
+ if (match) {
+ host = match[4]||match[2];
+ port = parseInt(match[7]);
+ path = match[8];
+ } else {
+ throw new Error(format(ERROR.INVALID_ARGUMENT,[host,"host"]));
+ }
+ } else {
+ if (arguments.length == 3) {
+ clientId = path;
+ path = "/mqtt";
+ }
+ if (typeof port !== "number" || port < 0)
+ throw new Error(format(ERROR.INVALID_TYPE, [typeof port, "port"]));
+ if (typeof path !== "string")
+ throw new Error(format(ERROR.INVALID_TYPE, [typeof path, "path"]));
+
+ var ipv6AddSBracket = (host.indexOf(":") !== -1 && host.slice(0,1) !== "[" && host.slice(-1) !== "]");
+ uri = "ws://"+(ipv6AddSBracket?"["+host+"]":host)+":"+port+path;
+ }
+
+ var clientIdLength = 0;
+ for (var i = 0; i
+ *
+ * @param {function} connectOptions.onFailure - called when the connect request has failed or timed out.
+ * A single response object parameter is passed to the onFailure callback containing the following fields:
+ *
+ *
+ * @param {array} connectOptions.hosts - If present this contains either a set of hostnames or fully qualified
+ * WebSocket URIs (ws://iot.eclipse.org:80/ws), that are tried in order in place
+ * of the host and port paramater on the construtor. The hosts are tried one at at time in order until
+ * one of then succeeds.
+ * @param {array} connectOptions.ports - If present the set of ports matching the hosts. If hosts contains URIs, this property
+ * is not used.
+ * @param {boolean} connectOptions.reconnect - Sets whether the client will automatically attempt to reconnect
+ * to the server if the connection is lost.
+ *
+ *
+ * @param {number} connectOptions.mqttVersion - The version of MQTT to use to connect to the MQTT Broker.
+ *
+ *
+ * @param {boolean} connectOptions.mqttVersionExplicit - If set to true, will force the connection to use the
+ * selected MQTT Version or will fail to connect.
+ * @param {array} connectOptions.uris - If present, should contain a list of fully qualified WebSocket uris
+ * (e.g. ws://iot.eclipse.org:80/ws), that are tried in order in place of the host and port parameter of the construtor.
+ * The uris are tried one at a time in order until one of them succeeds. Do not use this in conjunction with hosts as
+ * the hosts array will be converted to uris and will overwrite this property.
+ * @throws {InvalidState} If the client is not in disconnected state. The client must have received connectionLost
+ * or disconnected before calling connect for a second or subsequent time.
+ */
+ this.connect = function (connectOptions) {
+ connectOptions = connectOptions || {} ;
+ validate(connectOptions, {timeout:"number",
+ userName:"string",
+ password:"string",
+ willMessage:"object",
+ keepAliveInterval:"number",
+ cleanSession:"boolean",
+ useSSL:"boolean",
+ invocationContext:"object",
+ onSuccess:"function",
+ onFailure:"function",
+ hosts:"object",
+ ports:"object",
+ reconnect:"boolean",
+ mqttVersion:"number",
+ mqttVersionExplicit:"boolean",
+ uris: "object"});
+
+ // If no keep alive interval is set, assume 60 seconds.
+ if (connectOptions.keepAliveInterval === undefined)
+ connectOptions.keepAliveInterval = 60;
+
+ if (connectOptions.mqttVersion > 4 || connectOptions.mqttVersion < 3) {
+ throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.mqttVersion, "connectOptions.mqttVersion"]));
+ }
+
+ if (connectOptions.mqttVersion === undefined) {
+ connectOptions.mqttVersionExplicit = false;
+ connectOptions.mqttVersion = 4;
+ } else {
+ connectOptions.mqttVersionExplicit = true;
+ }
+
+ //Check that if password is set, so is username
+ if (connectOptions.password !== undefined && connectOptions.userName === undefined)
+ throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.password, "connectOptions.password"]));
+
+ if (connectOptions.willMessage) {
+ if (!(connectOptions.willMessage instanceof Message))
+ throw new Error(format(ERROR.INVALID_TYPE, [connectOptions.willMessage, "connectOptions.willMessage"]));
+ // The will message must have a payload that can be represented as a string.
+ // Cause the willMessage to throw an exception if this is not the case.
+ connectOptions.willMessage.stringPayload = null;
+
+ if (typeof connectOptions.willMessage.destinationName === "undefined")
+ throw new Error(format(ERROR.INVALID_TYPE, [typeof connectOptions.willMessage.destinationName, "connectOptions.willMessage.destinationName"]));
+ }
+ if (typeof connectOptions.cleanSession === "undefined")
+ connectOptions.cleanSession = true;
+ if (connectOptions.hosts) {
+
+ if (!(connectOptions.hosts instanceof Array) )
+ throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts, "connectOptions.hosts"]));
+ if (connectOptions.hosts.length <1 )
+ throw new Error(format(ERROR.INVALID_ARGUMENT, [connectOptions.hosts, "connectOptions.hosts"]));
+
+ var usingURIs = false;
+ for (var i = 0; i
+ *
+ * @param {function} subscribeOptions.onFailure - called when the subscribe request has failed or timed out.
+ * A single response object parameter is passed to the onFailure callback containing the following fields:
+ *
+ *
+ * @param {number} subscribeOptions.timeout - which, if present, determines the number of
+ * seconds after which the onFailure calback is called.
+ * The presence of a timeout does not prevent the onSuccess
+ * callback from being called when the subscribe completes.
+ * @throws {InvalidState} if the client is not in connected state.
+ */
+ this.subscribe = function (filter, subscribeOptions) {
+ if (typeof filter !== "string" && filter.constructor !== Array)
+ throw new Error("Invalid argument:"+filter);
+ subscribeOptions = subscribeOptions || {} ;
+ validate(subscribeOptions, {qos:"number",
+ invocationContext:"object",
+ onSuccess:"function",
+ onFailure:"function",
+ timeout:"number"
+ });
+ if (subscribeOptions.timeout && !subscribeOptions.onFailure)
+ throw new Error("subscribeOptions.timeout specified with no onFailure callback.");
+ if (typeof subscribeOptions.qos !== "undefined" && !(subscribeOptions.qos === 0 || subscribeOptions.qos === 1 || subscribeOptions.qos === 2 ))
+ throw new Error(format(ERROR.INVALID_ARGUMENT, [subscribeOptions.qos, "subscribeOptions.qos"]));
+ client.subscribe(filter, subscribeOptions);
+ };
+
+ /**
+ * Unsubscribe for messages, stop receiving messages sent to destinations described by the filter.
+ *
+ * @name Paho.Client#unsubscribe
+ * @function
+ * @param {string} filter - describing the destinations to receive messages from.
+ * @param {object} unsubscribeOptions - used to control the subscription
+ * @param {object} unsubscribeOptions.invocationContext - passed to the onSuccess callback
+ or onFailure callback.
+ * @param {function} unsubscribeOptions.onSuccess - called when the unsubscribe acknowledgement has been received from the server.
+ * A single response object parameter is passed to the
+ * onSuccess callback containing the following fields:
+ *
+ *
+ * @param {function} unsubscribeOptions.onFailure called when the unsubscribe request has failed or timed out.
+ * A single response object parameter is passed to the onFailure callback containing the following fields:
+ *
+ *
+ * @param {number} unsubscribeOptions.timeout - which, if present, determines the number of seconds
+ * after which the onFailure callback is called. The presence of
+ * a timeout does not prevent the onSuccess callback from being
+ * called when the unsubscribe completes
+ * @throws {InvalidState} if the client is not in connected state.
+ */
+ this.unsubscribe = function (filter, unsubscribeOptions) {
+ if (typeof filter !== "string" && filter.constructor !== Array)
+ throw new Error("Invalid argument:"+filter);
+ unsubscribeOptions = unsubscribeOptions || {} ;
+ validate(unsubscribeOptions, {invocationContext:"object",
+ onSuccess:"function",
+ onFailure:"function",
+ timeout:"number"
+ });
+ if (unsubscribeOptions.timeout && !unsubscribeOptions.onFailure)
+ throw new Error("unsubscribeOptions.timeout specified with no onFailure callback.");
+ client.unsubscribe(filter, unsubscribeOptions);
+ };
+
+ /**
+ * Send a message to the consumers of the destination in the Message.
+ *
+ * @name Paho.Client#send
+ * @function
+ * @param {string|Paho.Message} topic - mandatory The name of the destination to which the message is to be sent.
+ * - If it is the only parameter, used as Paho.Message object.
+ * @param {String|ArrayBuffer} payload - The message data to be sent.
+ * @param {number} qos The Quality of Service used to deliver the message.
+ *
+ *
+ * @param {Boolean} retained If true, the message is to be retained by the server and delivered
+ * to both current and future subscriptions.
+ * If false the server only delivers the message to current subscribers, this is the default for new Messages.
+ * A received message has the retained boolean set to true if the message was published
+ * with the retained boolean set to true
+ * and the subscrption was made after the message has been published.
+ * @throws {InvalidState} if the client is not connected.
+ */
+ this.send = function (topic,payload,qos,retained) {
+ var message ;
+
+ if(arguments.length === 0){
+ throw new Error("Invalid argument."+"length");
+
+ }else if(arguments.length == 1) {
+
+ if (!(topic instanceof Message) && (typeof topic !== "string"))
+ throw new Error("Invalid argument:"+ typeof topic);
+
+ message = topic;
+ if (typeof message.destinationName === "undefined")
+ throw new Error(format(ERROR.INVALID_ARGUMENT,[message.destinationName,"Message.destinationName"]));
+ client.send(message);
+
+ }else {
+ //parameter checking in Message object
+ message = new Message(payload);
+ message.destinationName = topic;
+ if(arguments.length >= 3)
+ message.qos = qos;
+ if(arguments.length >= 4)
+ message.retained = retained;
+ client.send(message);
+ }
+ };
+
+ /**
+ * Publish a message to the consumers of the destination in the Message.
+ * Synonym for Paho.Mqtt.Client#send
+ *
+ * @name Paho.Client#publish
+ * @function
+ * @param {string|Paho.Message} topic - mandatory The name of the topic to which the message is to be published.
+ * - If it is the only parameter, used as Paho.Message object.
+ * @param {String|ArrayBuffer} payload - The message data to be published.
+ * @param {number} qos The Quality of Service used to deliver the message.
+ *
+ *
+ * @param {Boolean} retained If true, the message is to be retained by the server and delivered
+ * to both current and future subscriptions.
+ * If false the server only delivers the message to current subscribers, this is the default for new Messages.
+ * A received message has the retained boolean set to true if the message was published
+ * with the retained boolean set to true
+ * and the subscrption was made after the message has been published.
+ * @throws {InvalidState} if the client is not connected.
+ */
+ this.publish = function(topic,payload,qos,retained) {
+ var message ;
+
+ if(arguments.length === 0){
+ throw new Error("Invalid argument."+"length");
+
+ }else if(arguments.length == 1) {
+
+ if (!(topic instanceof Message) && (typeof topic !== "string"))
+ throw new Error("Invalid argument:"+ typeof topic);
+
+ message = topic;
+ if (typeof message.destinationName === "undefined")
+ throw new Error(format(ERROR.INVALID_ARGUMENT,[message.destinationName,"Message.destinationName"]));
+ client.send(message);
+
+ }else {
+ //parameter checking in Message object
+ message = new Message(payload);
+ message.destinationName = topic;
+ if(arguments.length >= 3)
+ message.qos = qos;
+ if(arguments.length >= 4)
+ message.retained = retained;
+ client.send(message);
+ }
+ };
+
+ /**
+ * Normal disconnect of this Messaging client from its server.
+ *
+ * @name Paho.Client#disconnect
+ * @function
+ * @throws {InvalidState} if the client is already disconnected.
+ */
+ this.disconnect = function () {
+ client.disconnect();
+ };
+
+ /**
+ * Get the contents of the trace log.
+ *
+ * @name Paho.Client#getTraceLog
+ * @function
+ * @return {Object[]} tracebuffer containing the time ordered trace records.
+ */
+ this.getTraceLog = function () {
+ return client.getTraceLog();
+ };
+
+ /**
+ * Start tracing.
+ *
+ * @name Paho.Client#startTrace
+ * @function
+ */
+ this.startTrace = function () {
+ client.startTrace();
+ };
+
+ /**
+ * Stop tracing.
+ *
+ * @name Paho.Client#stopTrace
+ * @function
+ */
+ this.stopTrace = function () {
+ client.stopTrace();
+ };
+
+ this.isConnected = function() {
+ return client.connected;
+ };
+ };
+
+ /**
+ * An application message, sent or received.
+ *
+ *
+ *