eclipse / paho.mqtt.javascript

paho.mqtt.javascript
Other
1.15k stars 467 forks source link

Declare wireMessage var #170

Closed hgascoigne closed 5 years ago

hgascoigne commented 6 years ago

The wireMessage variable is not explicitly declared in certain places, causing runtime errors.

Should resolve https://github.com/eclipse/paho.mqtt.javascript/issues/168

pkuczynski commented 5 years ago

@hgascoigne your PR has a conflict. Would you like to solve it so we can review and merge?

pitus commented 5 years ago

Has this been resolved yet? I had to add var in line 949 or so (in ClientImpl.prototype.send) so it now reads: var wireMessage = new WireMessage(MESSAGE_TYPE.PUBLISH);

Also, I was trying to use pho-mqtt in a js module but I couldn't figure out how to properly import it? What I ended up doing is the following: 1) in my code that uses it: import '/node_modules/paho-mqtt/paho-mqtt.js'; // imports Paho.MQTT 2) in paho-mqtt.js line 92 added root test/setting as it was undefined:

        if( ! root )
            root = window;

Is there a better way to properly import it as an es6 module?

icraggs commented 5 years ago

This is fixed on both master and develop branches.