2017-02-02 7 views
0

次のエラーが発生しています。CloudMQTTでMQTT WebSocket接続に失敗しました

'WSS://m12.cloudmqtt.com:39297/MQTT' へのWebSocket接続に失敗しました:>接続確立中にエラー:ネットを:: ERR_CONNECTION_TIMED_OUT

私はからcloudmqttに接続しようとしていますパホクライアント。

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

ファイアウォールを設定しても問題ありません。

関連する問題