2017-02-02 19 views
0

Я получаю следующую ошибку.Не удалось подключиться к Интернету MQTT в CloudMQTT

WebSocket подключение к 'WSS: //m12.cloudmqtt.com: 39297/MQTT' не удалось: Ошибка в> установления соединения: сетка :: ERR_CONNECTION_TIMED_OUT

Я пытаюсь подключиться к cloudmqtt из клиент paho.

client = new Paho.MQTT.Client("m12.cloudmqtt.com", Number(39297), "client_1"); 
    // set callback handlers 
    client.onConnectionLost = onConnectionLost; 
    client.onMessageArrived = onMessageArrived; 

    // connect the client 
    var options = { 
      useSSL: true, 
      userName: "[email protected]", 
      password: "lM#$Ffg67OR", 
      cleanSession: true, 
      onSuccess:onConnect, 
      onFailure:doFail 
      } 

    //client.connect({onSuccess:onConnect}); 
    client.connect(options); 

    // called when the client connects 
    function onConnect() { 
     // Once a connection has been made, make a subscription and send a  message. 
    debugger; 
     console.log("onConnect"); 
     client.subscribe("outTopic"); 
     message = new Paho.MQTT.Message("Hello"); 
     message.destinationName = "World"; 
     client.send(message); 
    } 

    function doFail(){ 
     debugger; 
     console.log("dofail"); 
    } 
    // 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); 
     var msg = message.payloadString; 
     debugger; 

    } 

Когда я выполняю функцию программы, функция doFail() запускается? В чем может быть проблема?

ответ

0

Настроен брандмауэр, и он отлично работает.