eclipse-paho / paho.mqtt.android

MQTT Android
Other
2.94k stars 892 forks source link

use ssl:// scheme,return password or username error #477

Open woaimi520 opened 2 years ago

woaimi520 commented 2 years ago
    my  mqttConnectOptions setting , we just use ssl,
mqttConnectOptions?.apply {
            isCleanSession = false   //是否清除缓存
            isAutomaticReconnect = false//是否重连
            keepAliveInterval = 20 //,MQTT 协议中约定:在 1.5*Keep Alive 的时间间隔内,如果 Broker 没有收到来自 Client 的任何数据包,那么 Broker 认为它和 Client 之间的连接已经断开;同样地, 如果 Client 没有收到来自 Broker 的任何数据包,那么 Client 认为它和 Broker 之间的连接已经断开
            userName = clientUsername //登陆的名字
            password = clientPassword.toCharArray() //登陆的密码
            connectionTimeout = 10//超时时间
//            mqttVersion  = MqttConnectOptions.MQTT_VERSION_3_1_1
//            val mySslProperties = Properties()
//            mySslProperties.put(SSLSocketFactoryFactory.TRUSTSTOREPWD, true)
//            mySslProperties.put(SSLSocketFactoryFactory.CLIENTAUTH, false)
//            sslProperties = mySslProperties
//            socketFactory = MySocketFactory.getSocketFactory(context.resources.openRawResource(R.raw.ca),context.resources.openRawResource(R.raw.cer),context.resources.openRawResource(R.raw.key))
        }
IamLRBA commented 1 month ago

@woaimi520 , The error you're encountering seems to pop from configuring mqttConnectOptions while using SSL in your MQTT client. The specific details involve setting SSL properties, socket factories, and connection options like clean sessions, automatic reconnect, and timeouts. Please assign this issue to me so that i can try and work on it. Thanks!