Closed AhmedX6 closed 1 year ago
Please make sure you configured the client appropriately. It seems weird you aren't setting any username and password. Additionally you might have to provide a client certificate and/or the server certificate, depending on the broker's configuration and your target platform. I will try specifically with AWS when I have some time to make sure it's all in order, but as the broker is MQTT compliant it should work just fine.
I followed the documentation https://activemq.apache.org/how-do-i-use-ssl for creating ssl certificate. Could you provide a sample in Kotlin how to set path on TLSClientSettings data class ?
Where should i put my client/server certs etc.
Any news ?
Steps:
TLSClientSettings
constructor you need to pass the path to that file to the serverCertificatePath
parameter (for example TLSClientSettings(serverCertificatePath = "aws.crt")
).userName
and password
fields in the client constructor to your ActiveMQ username and password you set when creating the instance.Full sample:
val client = MQTTClient(
4, // MQTTVersion.MQTT3_1_1 if using the latest version
"id.mq.us-west-2.amazonaws.com",
8883,
TLSClientSettings(serverCertificatePath = "aws.crt"),
30,
userName = "testuser",
password = "testpassword".encodeToByteArray().toUByteArray()
) {
println(it.payload?.toByteArray()?.decodeToString())
}
thanks a lot for your answer, so LWT not working ?
I already replied to your question in this issue https://github.com/davidepianca98/KMQTT/issues/26#issuecomment-1709912159
Hi,
Trying to connect to an activemq instance on aws, Here is my source code:
Exception trapped
Using jitpack version 0.4.1
Please could you test on your side using amazon mq instance on mqtt protocol ?
Thanks