From fadc9520e4cd9d653fcf32bfec37297514226eda Mon Sep 17 00:00:00 2001 From: Adolfo Delorenzo Date: Mon, 13 Feb 2023 22:48:10 +0000 Subject: [PATCH] revert 06e8cc2ab65adf4e42f5b1f00df0fb846e02f7aa revert commit --- Dockerfile | 5 ---- demo.js | 70 ------------------------------------------------- index.html | 35 ------------------------- index.php | 33 ----------------------- mqttws31.min.js | 2 -- name.txt | 1 - style.css | 70 ------------------------------------------------- 7 files changed, 216 deletions(-) delete mode 100644 Dockerfile delete mode 100644 demo.js delete mode 100644 index.html delete mode 100644 index.php delete mode 100644 mqttws31.min.js delete mode 100644 name.txt delete mode 100644 style.css diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e57cd63..0000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -#FROM alastairhm/alpine-lighttpd-php:latest -FROM caddy/caddy -#COPY --chown=www-data index.html demo.js style.css mqttws31.min.js /var/www/localhost/htdocs/ -COPY index.html demo.js style.css mqttws31.min.js usr/share/caddy/ -# COPY --chown=www-data name.txt /var/www/ diff --git a/demo.js b/demo.js deleted file mode 100644 index dc1b1ad..0000000 --- a/demo.js +++ /dev/null @@ -1,70 +0,0 @@ -function startConnect(){ - - clientID = "clientID - "+parseInt(Math.random() * 100); - - host = document.getElementById("host").value; - port = document.getElementById("port").value; - userId = document.getElementById("username").value; - passwordId = document.getElementById("password").value; - - document.getElementById("messages").innerHTML += " Connecting to " + host + "on port " +port+"
"; - document.getElementById("messages").innerHTML += " Using the client Id " + clientID +"
"; - - client = new Paho.MQTT.Client(host,Number(port),clientID); - - client.onConnectionLost = onConnectionLost; - client.onMessageArrived = onMessageArrived; - - client.connect({ - onSuccess: onConnect -// userName: userId, - // passwordId: passwordId - }); - - -} - - -function onConnect(){ - topic = document.getElementById("topic_s").value; - - document.getElementById("messages").innerHTML += " Subscribing to topic "+topic + "
"; - - client.subscribe(topic); -} - - - -function onConnectionLost(responseObject){ - document.getElementById("messages").innerHTML += " ERROR: Connection is lost.
"; - if(responseObject !=0){ - document.getElementById("messages").innerHTML += " ERROR:"+ responseObject.errorMessage +"
"; - } -} - -function onMessageArrived(message){ - console.log("OnMessageArrived: "+message.payloadString); - document.getElementById("messages").innerHTML += " Topic:"+message.destinationName+"| Message : "+message.payloadString + "
"; -} - -function startDisconnect(){ - client.disconnect(); - document.getElementById("messages").innerHTML += " Disconnected.
"; - - - - -} - -function publishMessage(){ -msg = document.getElementById("Message").value; -topic = document.getElementById("topic_p").value; - -Message = new Paho.MQTT.Message(msg); -Message.destinationName = topic; - -client.send(Message); -document.getElementById("messages").innerHTML += " Message to topic "+topic+" is sent
"; - - -} diff --git a/index.html b/index.html deleted file mode 100644 index a5e6144..0000000 --- a/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - High Voltages - MQTT - - - - - -
-

High Voltages MQTT Dashboard



-
- Hostname or IP Address and Port Number: - - -
- Username and Password: -
- -
- Subscription topic: -

- -
-
Publish Topic and Message: - - - - -
-
-
- - diff --git a/index.php b/index.php deleted file mode 100644 index c10a149..0000000 --- a/index.php +++ /dev/null @@ -1,33 +0,0 @@ - - - - Name form - - - - - -

-
-
- Name: - -
-
-Name submitted

"; - } -} -$myfile = fopen("/var/www/name.txt", "a") or die("Unable to open file!"); -fwrite($myfile, "\n". $name); -fclose($myfile); -?> - - diff --git a/mqttws31.min.js b/mqttws31.min.js deleted file mode 100644 index 1291061..0000000 --- a/mqttws31.min.js +++ /dev/null @@ -1,2 +0,0 @@ -"undefined"==typeof Paho&&(Paho={}),Paho.MQTT=function(e){function t(e,t){var s=t,n=e[t],o=n>>4,r=n&=15;t+=1;var a,h=0,d=1;do{if(t==e.length)return[null,s];a=e[t++],h+=(127&a)*d,d*=128}while(0!=(128&a));var f=t+h;if(f>e.length)return[null,s];var l=new v(o);switch(o){case u.CONNACK:var _=e[t++];1&_&&(l.sessionPresent=!0),l.returnCode=e[t++];break;case u.PUBLISH:var g=r>>1&3,p=i(e,t);t+=2;var I=c(e,t,p);t+=p,g>0&&(l.messageIdentifier=i(e,t),t+=2);var w=new Paho.MQTT.Message(e.subarray(t,f));1==(1&r)&&(w.retained=!0),8==(8&r)&&(w.duplicate=!0),w.qos=g,w.destinationName=I,l.payloadMessage=w;break;case u.PUBACK:case u.PUBREC:case u.PUBREL:case u.PUBCOMP:case u.UNSUBACK:l.messageIdentifier=i(e,t);break;case u.SUBACK:l.messageIdentifier=i(e,t),t+=2,l.returnCode=e.subarray(t,f)}return[l,f]}function s(e,t,s){return t[s++]=e>>8,t[s++]=e%256,s}function n(e,t,n,i){return i=s(t,n,i),a(e,n,i),i+t}function i(e,t){return 256*e[t]+e[t+1]}function o(e){var t=new Array(1),s=0;do{var n=e%128;e>>=7,e>0&&(n|=128),t[s++]=n}while(e>0&&4>s);return t}function r(e){for(var t=0,s=0;s2047?(n>=55296&&56319>=n&&(s++,t++),t+=3):n>127?t+=2:t++}return t}function a(e,t,s){for(var n=s,i=0;i=55296&&56319>=o){var r=e.charCodeAt(++i);if(isNaN(r))throw new Error(g(l.MALFORMED_UNICODE,[o,r]));o=(o-55296<<10)+(r-56320)+65536}127>=o?t[n++]=o:2047>=o?(t[n++]=o>>6&31|192,t[n++]=63&o|128):65535>=o?(t[n++]=o>>12&15|224,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>18&7|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128)}return t}function c(e,t,s){for(var n,i="",o=t;t+s>o;){var r=e[o++];if(128>r)n=r;else{var a=e[o++]-128;if(0>a)throw new Error(g(l.MALFORMED_UTF,[r.toString(16),a.toString(16),""]));if(224>r)n=64*(r-192)+a;else{var c=e[o++]-128;if(0>c)throw new Error(g(l.MALFORMED_UTF,[r.toString(16),a.toString(16),c.toString(16)]));if(240>r)n=4096*(r-224)+64*a+c;else{var h=e[o++]-128;if(0>h)throw new Error(g(l.MALFORMED_UTF,[r.toString(16),a.toString(16),c.toString(16),h.toString(16)]));if(!(248>r))throw new Error(g(l.MALFORMED_UTF,[r.toString(16),a.toString(16),c.toString(16),h.toString(16)]));n=262144*(r-240)+4096*a+64*c+h}}}n>65535&&(n-=65536,i+=String.fromCharCode(55296+(n>>10)),n=56320+(1023&n)),i+=String.fromCharCode(n)}return i}var h="@VERSION@",u={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},d=function(e,t){for(var s in e)if(e.hasOwnProperty(s)){if(!t.hasOwnProperty(s)){var n="Unknown property, "+s+". Valid properties are:";for(var s in t)t.hasOwnProperty(s)&&(n=n+" "+s);throw new Error(n)}if(typeof e[s]!==t[s])throw new Error(g(l.INVALID_TYPE,[typeof e[s],s]))}},f=function(e,t){return function(){return e.apply(t,arguments)}},l={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}."}},_={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"},g=function(e,t){var s=e.text;if(t)for(var n,i,o=0;o0){var r=s.substring(0,i),a=s.substring(i+n.length);s=r+t[o]+a}return s},p=[0,6,77,81,73,115,100,112,3],I=[0,4,77,81,84,84,4],v=function(e,t){this.type=e;for(var s in t)t.hasOwnProperty(s)&&(this[s]=t[s])};v.prototype.encode=function(){var e=(15&this.type)<<4,t=0,i=new Array,a=0;switch(void 0!=this.messageIdentifier&&(t+=2),this.type){case u.CONNECT:switch(this.mqttVersion){case 3:t+=p.length+3;break;case 4:t+=I.length+3}if(t+=r(this.clientId)+2,void 0!=this.willMessage){t+=r(this.willMessage.destinationName)+2;var c=this.willMessage.payloadBytes;c instanceof Uint8Array||(c=new Uint8Array(d)),t+=c.byteLength+2}void 0!=this.userName&&(t+=r(this.userName)+2),void 0!=this.password&&(t+=r(this.password)+2);break;case u.SUBSCRIBE:e|=2;for(var h=0;h0&&(this.timeout=setTimeout(i(this),this._keepAliveInterval))},this.cancel=function(){this._window.clearTimeout(this.timeout)}},E=function(e,t,s,n,i){this._window=t,s||(s=30);var o=function(e,t,s){return function(){return e.apply(t,s)}};this.timeout=setTimeout(o(n,e,i),1e3*s),this.cancel=function(){this._window.clearTimeout(this.timeout)}},y=function(t,s,n,i,o){if(!("WebSocket"in e&&null!==e.WebSocket))throw new Error(g(l.UNSUPPORTED,["WebSocket"]));if(!("localStorage"in e&&null!==e.localStorage))throw new Error(g(l.UNSUPPORTED,["localStorage"]));if(!("ArrayBuffer"in e&&null!==e.ArrayBuffer))throw new Error(g(l.UNSUPPORTED,["ArrayBuffer"]));this._trace("Paho.MQTT.Client",t,s,n,i,o),this.host=s,this.port=n,this.path=i,this.uri=t,this.clientId=o,this._localKey=s+":"+n+("/mqtt"!=i?":"+i:"")+":"+o+":",this._msg_queue=[],this._sentMessages={},this._receivedMessages={},this._notify_msg_sent={},this._message_identifier=1,this._sequence=0;for(var r in localStorage)0!=r.indexOf("Sent:"+this._localKey)&&0!=r.indexOf("Received:"+this._localKey)||this.restore(r)};y.prototype.host,y.prototype.port,y.prototype.path,y.prototype.uri,y.prototype.clientId,y.prototype.socket,y.prototype.connected=!1,y.prototype.maxMessageIdentifier=65536,y.prototype.connectOptions,y.prototype.hostIndex,y.prototype.onConnectionLost,y.prototype.onMessageDelivered,y.prototype.onMessageArrived,y.prototype.traceFunction,y.prototype._msg_queue=null,y.prototype._connectTimeout,y.prototype.sendPinger=null,y.prototype.receivePinger=null,y.prototype.receiveBuffer=null,y.prototype._traceBuffer=null,y.prototype._MAX_TRACE_ENTRIES=100,y.prototype.connect=function(e){var t=this._traceMask(e,"password");if(this._trace("Client.connect",t,this.socket,this.connected),this.connected)throw new Error(g(l.INVALID_STATE,["already connected"]));if(this.socket)throw new Error(g(l.INVALID_STATE,["already connected"]));this.connectOptions=e,e.uris?(this.hostIndex=0,this._doConnect(e.uris[0])):this._doConnect(this.uri)},y.prototype.subscribe=function(e,t){if(this._trace("Client.subscribe",e,t),!this.connected)throw new Error(g(l.INVALID_STATE,["not connected"]));var s=new v(u.SUBSCRIBE);s.topics=[e],void 0!=t.qos?s.requestedQos=[t.qos]:s.requestedQos=[0],t.onSuccess&&(s.onSuccess=function(e){t.onSuccess({invocationContext:t.invocationContext,grantedQos:e})}),t.onFailure&&(s.onFailure=function(e){t.onFailure({invocationContext:t.invocationContext,errorCode:e})}),t.timeout&&(s.timeOut=new E(this,window,t.timeout,t.onFailure,[{invocationContext:t.invocationContext,errorCode:l.SUBSCRIBE_TIMEOUT.code,errorMessage:g(l.SUBSCRIBE_TIMEOUT)}])),this._requires_ack(s),this._schedule_message(s)},y.prototype.unsubscribe=function(e,t){if(this._trace("Client.unsubscribe",e,t),!this.connected)throw new Error(g(l.INVALID_STATE,["not connected"]));var s=new v(u.UNSUBSCRIBE);s.topics=[e],t.onSuccess&&(s.callback=function(){t.onSuccess({invocationContext:t.invocationContext})}),t.timeout&&(s.timeOut=new E(this,window,t.timeout,t.onFailure,[{invocationContext:t.invocationContext,errorCode:l.UNSUBSCRIBE_TIMEOUT.code,errorMessage:g(l.UNSUBSCRIBE_TIMEOUT)}])),this._requires_ack(s),this._schedule_message(s)},y.prototype.send=function(e){if(this._trace("Client.send",e),!this.connected)throw new Error(g(l.INVALID_STATE,["not connected"]));wireMessage=new v(u.PUBLISH),wireMessage.payloadMessage=e,e.qos>0?this._requires_ack(wireMessage):this.onMessageDelivered&&(this._notify_msg_sent[wireMessage]=this.onMessageDelivered(wireMessage.payloadMessage)),this._schedule_message(wireMessage)},y.prototype.disconnect=function(){if(this._trace("Client.disconnect"),!this.socket)throw new Error(g(l.INVALID_STATE,["not connecting or connected"]));wireMessage=new v(u.DISCONNECT),this._notify_msg_sent[wireMessage]=f(this._disconnected,this),this._schedule_message(wireMessage)},y.prototype.getTraceLog=function(){if(null!==this._traceBuffer){this._trace("Client.getTraceLog",new Date),this._trace("Client.getTraceLog in flight messages",this._sentMessages.length);for(var e in this._sentMessages)this._trace("_sentMessages ",e,this._sentMessages[e]);for(var e in this._receivedMessages)this._trace("_receivedMessages ",e,this._receivedMessages[e]);return this._traceBuffer}},y.prototype.startTrace=function(){null===this._traceBuffer&&(this._traceBuffer=[]),this._trace("Client.startTrace",new Date,h)},y.prototype.stopTrace=function(){delete this._traceBuffer},y.prototype._doConnect=function(e){if(this.connectOptions.useSSL){var t=e.split(":");t[0]="wss",e=t.join(":")}this.connected=!1,this.connectOptions.mqttVersion<4?this.socket=new WebSocket(e,["mqttv3.1"]):this.socket=new WebSocket(e,["mqtt"]),this.socket.binaryType="arraybuffer",this.socket.onopen=f(this._on_socket_open,this),this.socket.onmessage=f(this._on_socket_message,this),this.socket.onerror=f(this._on_socket_error,this),this.socket.onclose=f(this._on_socket_close,this),this.sendPinger=new w(this,window,this.connectOptions.keepAliveInterval),this.receivePinger=new w(this,window,this.connectOptions.keepAliveInterval),this._connectTimeout=new E(this,window,this.connectOptions.timeout,this._disconnected,[l.CONNECT_TIMEOUT.code,g(l.CONNECT_TIMEOUT)])},y.prototype._schedule_message=function(e){this._msg_queue.push(e),this.connected&&this._process_queue()},y.prototype.store=function(e,t){var s={type:t.type,messageIdentifier:t.messageIdentifier,version:1};switch(t.type){case u.PUBLISH:t.pubRecReceived&&(s.pubRecReceived=!0),s.payloadMessage={};for(var n="",i=t.payloadMessage.payloadBytes,o=0;o=2;){var c=parseInt(i.substring(0,2),16);i=i.substring(2,i.length),r[a++]=c}var h=new Paho.MQTT.Message(r);h.qos=s.payloadMessage.qos,h.destinationName=s.payloadMessage.destinationName,s.payloadMessage.duplicate&&(h.duplicate=!0),s.payloadMessage.retained&&(h.retained=!0),n.payloadMessage=h;break;default:throw Error(g(l.INVALID_STORED_DATA,[e,t]))}0==e.indexOf("Sent:"+this._localKey)?(n.payloadMessage.duplicate=!0,this._sentMessages[n.messageIdentifier]=n):0==e.indexOf("Received:"+this._localKey)&&(this._receivedMessages[n.messageIdentifier]=n)},y.prototype._process_queue=function(){for(var e=null,t=this._msg_queue.reverse();e=t.pop();)this._socket_send(e),this._notify_msg_sent[e]&&(this._notify_msg_sent[e](),delete this._notify_msg_sent[e])},y.prototype._requires_ack=function(e){var t=Object.keys(this._sentMessages).length;if(t>this.maxMessageIdentifier)throw Error("Too many messages:"+t);for(;void 0!==this._sentMessages[this._message_identifier];)this._message_identifier++;e.messageIdentifier=this._message_identifier,this._sentMessages[e.messageIdentifier]=e,e.type===u.PUBLISH&&this.store("Sent:",e),this._message_identifier===this.maxMessageIdentifier&&(this._message_identifier=1)},y.prototype._on_socket_open=function(){var e=new v(u.CONNECT,this.connectOptions);e.clientId=this.clientId,this._socket_send(e)},y.prototype._on_socket_message=function(e){this._trace("Client._on_socket_message",e.data);for(var t=this._deframeMessages(e.data),s=0;sr;r++){var s=i[r];if(s.type==u.PUBLISH&&s.pubRecReceived){var c=new v(u.PUBREL,{messageIdentifier:s.messageIdentifier});this._schedule_message(c)}else this._schedule_message(s)}this.connectOptions.onSuccess&&this.connectOptions.onSuccess({invocationContext:this.connectOptions.invocationContext}),this._process_queue();break;case u.PUBLISH:this._receivePublish(e);break;case u.PUBACK:var s=this._sentMessages[e.messageIdentifier];s&&(delete this._sentMessages[e.messageIdentifier],localStorage.removeItem("Sent:"+this._localKey+e.messageIdentifier),this.onMessageDelivered&&this.onMessageDelivered(s.payloadMessage));break;case u.PUBREC:var s=this._sentMessages[e.messageIdentifier];if(s){s.pubRecReceived=!0;var c=new v(u.PUBREL,{messageIdentifier:e.messageIdentifier});this.store("Sent:",s),this._schedule_message(c)}break;case u.PUBREL:var n=this._receivedMessages[e.messageIdentifier];localStorage.removeItem("Received:"+this._localKey+e.messageIdentifier),n&&(this._receiveMessage(n),delete this._receivedMessages[e.messageIdentifier]);var h=new v(u.PUBCOMP,{messageIdentifier:e.messageIdentifier});this._schedule_message(h);break;case u.PUBCOMP:var s=this._sentMessages[e.messageIdentifier];delete this._sentMessages[e.messageIdentifier],localStorage.removeItem("Sent:"+this._localKey+e.messageIdentifier),this.onMessageDelivered&&this.onMessageDelivered(s.payloadMessage);break;case u.SUBACK:var s=this._sentMessages[e.messageIdentifier];s&&(s.timeOut&&s.timeOut.cancel(),128===e.returnCode[0]?s.onFailure&&s.onFailure(e.returnCode):s.onSuccess&&s.onSuccess(e.returnCode),delete this._sentMessages[e.messageIdentifier]);break;case u.UNSUBACK:var s=this._sentMessages[e.messageIdentifier];s&&(s.timeOut&&s.timeOut.cancel(),s.callback&&s.callback(),delete this._sentMessages[e.messageIdentifier]);break;case u.PINGRESP:this.sendPinger.reset();break;case u.DISCONNECT:this._disconnected(l.INVALID_MQTT_MESSAGE_TYPE.code,g(l.INVALID_MQTT_MESSAGE_TYPE,[e.type]));break;default:this._disconnected(l.INVALID_MQTT_MESSAGE_TYPE.code,g(l.INVALID_MQTT_MESSAGE_TYPE,[e.type]))}}catch(d){return void this._disconnected(l.INTERNAL_ERROR.code,g(l.INTERNAL_ERROR,[d.message,d.stack.toString()]))}},y.prototype._on_socket_error=function(e){this._disconnected(l.SOCKET_ERROR.code,g(l.SOCKET_ERROR,[e.data]))},y.prototype._on_socket_close=function(){this._disconnected(l.SOCKET_CLOSE.code,g(l.SOCKET_CLOSE))},y.prototype._socket_send=function(e){if(1==e.type){var t=this._traceMask(e,"password");this._trace("Client._socket_send",t)}else this._trace("Client._socket_send",e);this.socket.send(e.encode()),this.sendPinger.reset()},y.prototype._receivePublish=function(e){switch(e.payloadMessage.qos){case"undefined":case 0:this._receiveMessage(e);break;case 1:var t=new v(u.PUBACK,{messageIdentifier:e.messageIdentifier});this._schedule_message(t),this._receiveMessage(e);break;case 2:this._receivedMessages[e.messageIdentifier]=e,this.store("Received:",e);var s=new v(u.PUBREC,{messageIdentifier:e.messageIdentifier});this._schedule_message(s);break;default:throw Error("Invaild qos="+wireMmessage.payloadMessage.qos)}},y.prototype._receiveMessage=function(e){this.onMessageArrived&&this.onMessageArrived(e.payloadMessage)},y.prototype._disconnected=function(e,t){this._trace("Client._disconnected",e,t),this.sendPinger.cancel(),this.receivePinger.cancel(),this._connectTimeout&&this._connectTimeout.cancel(),this._msg_queue=[],this._notify_msg_sent={},this.socket&&(this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,1===this.socket.readyState&&this.socket.close(),delete this.socket),this.connectOptions.uris&&this.hostIndexe;e++)this._traceBuffer.length==this._MAX_TRACE_ENTRIES&&this._traceBuffer.shift(),0===e?this._traceBuffer.push(arguments[e]):"undefined"==typeof arguments[e]?this._traceBuffer.push(arguments[e]):this._traceBuffer.push(" "+JSON.stringify(arguments[e]))},y.prototype._traceMask=function(e,t){var s={};for(var n in e)e.hasOwnProperty(n)&&(n==t?s[n]="******":s[n]=e[n]);return s};var M=function(e,t,s,n){var i;if("string"!=typeof e)throw new Error(g(l.INVALID_TYPE,[typeof e,"host"]));if(2==arguments.length){n=t,i=e;var o=i.match(/^(wss?):\/\/((\[(.+)\])|([^\/]+?))(:(\d+))?(\/.*)$/);if(!o)throw new Error(g(l.INVALID_ARGUMENT,[e,"host"]));e=o[4]||o[2],t=parseInt(o[7]),s=o[8]}else{if(3==arguments.length&&(n=s,s="/mqtt"),"number"!=typeof t||0>t)throw new Error(g(l.INVALID_TYPE,[typeof t,"port"]));if("string"!=typeof s)throw new Error(g(l.INVALID_TYPE,[typeof s,"path"]));var r=-1!=e.indexOf(":")&&"["!=e.slice(0,1)&&"]"!=e.slice(-1);i="ws://"+(r?"["+e+"]":e)+":"+t+s}for(var a=0,c=0;c=55296&&56319>=h&&c++,a++}if("string"!=typeof n||a>65535)throw new Error(g(l.INVALID_ARGUMENT,[n,"clientId"]));var u=new y(i,e,t,s,n);this._getHost=function(){return e},this._setHost=function(){throw new Error(g(l.UNSUPPORTED_OPERATION))},this._getPort=function(){return t},this._setPort=function(){throw new Error(g(l.UNSUPPORTED_OPERATION))},this._getPath=function(){return s},this._setPath=function(){throw new Error(g(l.UNSUPPORTED_OPERATION))},this._getURI=function(){return i},this._setURI=function(){throw new Error(g(l.UNSUPPORTED_OPERATION))},this._getClientId=function(){return u.clientId},this._setClientId=function(){throw new Error(g(l.UNSUPPORTED_OPERATION))},this._getOnConnectionLost=function(){return u.onConnectionLost},this._setOnConnectionLost=function(e){if("function"!=typeof e)throw new Error(g(l.INVALID_TYPE,[typeof e,"onConnectionLost"]));u.onConnectionLost=e},this._getOnMessageDelivered=function(){return u.onMessageDelivered},this._setOnMessageDelivered=function(e){if("function"!=typeof e)throw new Error(g(l.INVALID_TYPE,[typeof e,"onMessageDelivered"]));u.onMessageDelivered=e},this._getOnMessageArrived=function(){return u.onMessageArrived},this._setOnMessageArrived=function(e){if("function"!=typeof e)throw new Error(g(l.INVALID_TYPE,[typeof e,"onMessageArrived"]));u.onMessageArrived=e},this._getTrace=function(){return u.traceFunction},this._setTrace=function(e){if("function"!=typeof e)throw new Error(g(l.INVALID_TYPE,[typeof e,"onTrace"]));u.traceFunction=e},this.connect=function(e){if(e=e||{},d(e,{timeout:"number",userName:"string",password:"string",willMessage:"object",keepAliveInterval:"number",cleanSession:"boolean",useSSL:"boolean",invocationContext:"object",onSuccess:"function",onFailure:"function",hosts:"object",ports:"object",mqttVersion:"number",mqttVersionExplicit:"boolean",uris:"object"}),void 0===e.keepAliveInterval&&(e.keepAliveInterval=60),e.mqttVersion>4||e.mqttVersion<3)throw new Error(g(l.INVALID_ARGUMENT,[e.mqttVersion,"connectOptions.mqttVersion"]));if(void 0===e.mqttVersion?(e.mqttVersionExplicit=!1,e.mqttVersion=4):e.mqttVersionExplicit=!0,void 0!==e.password&&void 0===e.userName)throw new Error(g(l.INVALID_ARGUMENT,[e.password,"connectOptions.password"]));if(e.willMessage){if(!(e.willMessage instanceof m))throw new Error(g(l.INVALID_TYPE,[e.willMessage,"connectOptions.willMessage"]));if(e.willMessage.stringPayload,"undefined"==typeof e.willMessage.destinationName)throw new Error(g(l.INVALID_TYPE,[typeof e.willMessage.destinationName,"connectOptions.willMessage.destinationName"]))}if("undefined"==typeof e.cleanSession&&(e.cleanSession=!0),e.hosts){if(!(e.hosts instanceof Array))throw new Error(g(l.INVALID_ARGUMENT,[e.hosts,"connectOptions.hosts"]));if(e.hosts.length<1)throw new Error(g(l.INVALID_ARGUMENT,[e.hosts,"connectOptions.hosts"]));for(var t=!1,n=0;n=3&&(i.qos=s),arguments.length>=4&&(i.retained=n),u.send(i)},this.disconnect=function(){u.disconnect()},this.getTraceLog=function(){return u.getTraceLog()},this.startTrace=function(){u.startTrace()},this.stopTrace=function(){u.stopTrace()},this.isConnected=function(){return u.connected}};M.prototype={get host(){return this._getHost()},set host(e){this._setHost(e)},get port(){return this._getPort()},set port(e){this._setPort(e)},get path(){return this._getPath()},set path(e){this._setPath(e)},get clientId(){return this._getClientId()},set clientId(e){this._setClientId(e)},get onConnectionLost(){return this._getOnConnectionLost()},set onConnectionLost(e){this._setOnConnectionLost(e)},get onMessageDelivered(){return this._getOnMessageDelivered()},set onMessageDelivered(e){this._setOnMessageDelivered(e)},get onMessageArrived(){return this._getOnMessageArrived()},set onMessageArrived(e){this._setOnMessageArrived(e)},get trace(){return this._getTrace()},set trace(e){this._setTrace(e)}};var m=function(e){var t;if(!("string"==typeof e||e instanceof ArrayBuffer||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array))throw g(l.INVALID_ARGUMENT,[e,"newPayload"]);t=e,this._getPayloadString=function(){return"string"==typeof t?t:c(t,0,t.length)},this._getPayloadBytes=function(){if("string"==typeof t){var e=new ArrayBuffer(r(t)),s=new Uint8Array(e);return a(t,s,0),s}return t};var s=void 0;this._getDestinationName=function(){return s},this._setDestinationName=function(e){if("string"!=typeof e)throw new Error(g(l.INVALID_ARGUMENT,[e,"newDestinationName"]));s=e};var n=0;this._getQos=function(){return n},this._setQos=function(e){if(0!==e&&1!==e&&2!==e)throw new Error("Invalid argument:"+e);n=e};var i=!1;this._getRetained=function(){return i},this._setRetained=function(e){if("boolean"!=typeof e)throw new Error(g(l.INVALID_ARGUMENT,[e,"newRetained"]));i=e};var o=!1;this._getDuplicate=function(){return o},this._setDuplicate=function(e){o=e}};return m.prototype={get payloadString(){return this._getPayloadString()},get payloadBytes(){return this._getPayloadBytes()},get destinationName(){return this._getDestinationName()},set destinationName(e){this._setDestinationName(e)},get qos(){return this._getQos()},set qos(e){this._setQos(e)},get retained(){return this._getRetained()},set retained(e){this._setRetained(e)},get duplicate(){return this._getDuplicate()},set duplicate(e){this._setDuplicate(e)}},{Client:M,Message:m}}(window); -//# sourceMappingURL=mqttws31.min.js.map \ No newline at end of file diff --git a/name.txt b/name.txt deleted file mode 100644 index a0b7a67..0000000 --- a/name.txt +++ /dev/null @@ -1 +0,0 @@ -Adolfo Delorenzo diff --git a/style.css b/style.css deleted file mode 100644 index c66b798..0000000 --- a/style.css +++ /dev/null @@ -1,70 +0,0 @@ -body { - font-family: "Open Sans", sans-serif; -} -.wrapper { - margin-left: auto; - margin-right: auto; - width: 60%; - padding-right: 10px; - padding-left: 10px; -} - -input { - width : 150px; - margin: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -input[type=text] { - width:100%; - padding: 12px 12px; - height: 10px; - - margin: 8px 0; -} -input[type=password] { - width:100%; - padding: 12px 12px; - height: 10px; - - margin: 4px 2px; -} -input[type=button] { - background-color: gray; - border: none; - color: black; - - text-decoration: none; - font-weight: bold; - height: 20px; - - margin: 4px 2px; - cursor: pointer; -} -input[type=text]:focus { - background-color: lightblue; -} -input[type=button]:hover { - background-color: #686868; -} - -#Main_heading{ - text-align: center; -} - -#messages { - margin-top: 12px; - margin-bottom: 12px; - padding: 12px; - width:100%; - display: inline-block; - border:1px solid black; - max-height: 250px; - min-height: 250px; - overflow: scroll; -} -#messages span { - overflow-y: scroll; - overflow: scroll; -}