Java -Client für MQTT WebSocket mit vorgestellter URLJava

Java-Forum
Anonymous
 Java -Client für MQTT WebSocket mit vorgestellter URL

Post by Anonymous »

Die vorgeschriebene Websocket -URL ist so etwas wie diese WSS: // .eu-west-1.amazonaws.com: 443/mqtt? x-amz-algorithmus = aws4-hmac-sha256 & x-amz-credential = /eu-west-1/iotdevicegateway/aws4_request & X-AMZ-dat = 20250814t085431z & X-AMZ-Expires = 86400 & X-AMZ-Signedheaders = Host & X-AMZ-Signature = & X-Amz-Security-Token =
Und hier ist mein Code < /p>

Code: Select all

    AwsIotMqttConnectionBuilder builder = AwsIotMqttConnectionBuilder.newMtlsBuilderFromPath(null, null)
.withWebsockets(true) // Crucial for presigned URL connections
.withEndpoint(connectionUrl) // Pass the presigned URL here
.withClientId(clientId)
.withConnectionEventCallbacks(callbacks)
.withWebsocketSigningRegion("eu-west-1")
.withPort(443); // Default WebSocket port

MqttClientConnection connection = builder.build();

// Connect to AWS IoT Core
CompletableFuture connected = connection.connect();
connected.get(); // Wait for connection to complete
Ich erhalte den folgenden Fehler, wenn ich den Code ausführe.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post