eclipse / paho.mqtt.m2mqtt

Eclipse Public License 1.0
512 stars 303 forks source link

Subscribe more than 8 topics in sequence will be failed #115

Open s0920832252 opened 4 years ago

s0920832252 commented 4 years ago
        When i subscribe more than 8 topics , the event MqttMsgSubscribed won't be triggered.
        according the situation , i think the subscribtion is not successed. but i don't know why...
        how can i fix it , please help me , 
        Thanks.
        my need is subscribe at lease 20 topics.  

        _mqttConnecter.AddTopic($"$aws/things/test-{_localID}1/shadow/update", MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE);
        _mqttConnecter.AddTopic($"$aws/things/test-{_localID}2/shadow/update", MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE);
        _mqttConnecter.AddTopic($"$aws/things/test-{_localID}3/shadow/update", MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE);
        _mqttConnecter.AddTopic($"$aws/things/test-{_localID}4/shadow/update", MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE);
        _mqttConnecter.AddTopic($"$aws/things/test-{_localID}5/shadow/update", MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE);
        _mqttConnecter.AddTopic($"$aws/things/test-{_localID}6/shadow/update", MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE);
        _mqttConnecter.AddTopic($"$aws/things/test-{_localID}7/shadow/update", MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE);
        _mqttConnecter.AddTopic($"$aws/things/test-{_localID}8/shadow/update", MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE);
shoover commented 4 years ago

It's a protocol limitation (AWS). You can subscribe multiple batches of 8 on the same connection.

s0920832252 commented 4 years ago

thanks , you are right. my example code has error.

the AWS limitation are

  1. not more than 50 topices on the same connection.
  2. not more than 8 topices on the same subscribed action sorry about this.