Reputation: 1354
I have an issue with AWS IoT. I was using the same code for month. But suddenly it stopped working. I'm using Mqtt over Websocket with AWS IoT.
This is the simple bit of code I use.
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();
}
}
}
And I got this log :
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
At this stage I have no clue what is wrong. I was using this code for month. Nothing have changed and now it stopped working.
if somebody can help me sort this out, it would be awesome. Thanks.
Upvotes: 4
Views: 4408
Reputation: 11
I also have the same issue, Actually, if you are using the same access key and secret key in multiple regions you will face this issue. I have created different users for each region. it fixes the issue.
Upvotes: 1
Reputation: 56
https://github.com/aws/aws-iot-device-sdk-java/issues/23
Might be due to org.eclipse.paho getting upgrade v1.1.1
Upvotes: 3