J'ai un problème avec AWS IoT. J'utilisais le même code pour le mois. Mais soudain, il a cessé de fonctionner. J'utilise Mqtt sur Websocket avec AWS IoT.En-tête de connexion incorrect avec MQTT sur Websocket avec AWS IoT
C'est le simple code que j'utilise.
import com.amazonaws.services.iot.client.AWSIotException;
import com.amazonaws.services.iot.client.AWSIotMqttClient;
public class ThingMain {
public static void main(String[] args) {
String clientEndpoint = "endpoint.iot.us-west-2.amazonaws.com";
String clientId = "testing";
AWSIotMqttClient client = new AWSIotMqttClient(clientEndpoint, clientId, "accessKey", "secretKey");
try {
client.connect();
} catch (AWSIotException e) {
e.printStackTrace();
}
}
}
Et je suis arrivé ce journal:
AVERTISSEMENT: Connect request failure
MqttException (0) - java.io.IOException: WebSocket Response header: Incorrect connection header
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:38)
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:690)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: WebSocket Response header: Incorrect connection header
at org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketHandshake.receiveHandshakeResponse(WebSocketHandshake.java:144)
at org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketHandshake.execute(WebSocketHandshake.java:74)
at org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketSecureNetworkModule.start(WebSocketSecureNetworkModule.java:77)
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:676)
... 1 more
avr. 04, 2017 11:00:55 PM
com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionFailure
INFOS: Connection temporarily lost
avr. 04, 2017 11:00:55 PM
com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionFailure
INFOS: Client connection lost: leet
avr. 04, 2017 11:00:58 PM
com.amazonaws.services.iot.client.core.AwsIotConnection$1 run
INFOS: Connection is being retried
A ce stade, je n'ai aucune idée ce qui est faux. J'utilisais ce code pour le mois. Rien n'a changé et maintenant il a cessé de fonctionner.
Si quelqu'un peut m'aider à résoudre ce problème, ce serait génial. Merci.
Merci ce résoudre mon problème. J'ai ajouté cette ligne à mes dépendances '' '" compile (groupe: 'org.eclipse.paho', nom: 'org.eclipse.paho.client.mqttv3', version: '1.1.0') {force = true} "' '' – Sapher