Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Errors using Paho to connect to broker.mqttdashboard.com

And I think I've answered my own question. When I retained "client" in a variable outside of this function, things are starting to move along. 

D.



On Fri, Dec 13, 2013 at 3:33 PM, David Janes <davidjanes@xxxxxxxxxxxxxx> wrote:
This is my first attempt at using Paho in the browser and I'm trying to duplicate what (http://www.hivemq.com/demos/websocket-client/?) does. Unfortunately, all I get is 

onConnectionLost:AMQJS0005E Internal error. 

I've been successful at connecting to the broker from the command line using Mosquitto.

Now I realize that the Internal error is happening in "broker.mqttdashboard.com" but since it works on their website, it must be the way I'm calling it. So the question is : am I doing something obviously wrong in the following code:

var location = { 
    hostname: "broker.mqttdashboard.com",
    port: 8000,
    clientid: "iot-" + ("" + Math.random()).substring(2)
};  
var client = new Messaging.Client(
    location.hostname, 
    location.port,
    location.clientid
);  

client._onConnectionLost_ = js.mqtt.onConnectionLost;
client._onMessageArrived_ = js.mqtt.onMessageArrived;

var connectd = {
    timeout: 3,
    keepAliveInterval: 60,
    cleanSession: true,
    useSSL: false,

    onSuccess:js.mqtt.onConnect,
    onFailure:js.mqtt.onFailure
}
client.connect(connectd);



Back to the top