Open Sunchild81 opened 6 years ago
I get same error with React(create react app). However if I plug paho-mqtt with pure JS it works as expected.
I get same error. I found the error caused by
var message = new Paho.MQTT.Message(input.subarray(pos, endPos));
it can be fix by this:
import PahoMQTT from 'paho-mqtt'
global.Paho = {
MQTT: PahoMQTT
}
I worked on this all day, I love you! @AdamChrist
Hi all,
In my onConnect cb I'm simply trying to send a "Hello" message on the topic I subscribed to just before I send it. However, for some reason it's giving me a TypeError: Cannot read property length of undefined, which point me to this section:
So messages is undefined apparently. I'm hoping somebody encountered this before or could point me in the right direction. Or perhaps it's a bug, but seems unlikely since nobody's having this issue as of yet.
I'm using React 15.4.1 with WebPack and npm package paho-mqtt 1.0.4 I thought it might be related to below issue 150. However the proposed solution didn't help me: https://github.com/eclipse/paho.mqtt.javascript/issues/150
What I'm doing is real straightforward:
And my onConnect handling:
Thanks all!