1 2 3 4 Previous Next 46 Replies Latest reply on Feb 6, 2018 8:00 PM by AxLi_1746341

    MQTT Reconnection causing hang in the system

      Hi mwf_mmfae,

       

      I am not able to do a Reconnect to MQTT If the connection goes down. I can see a hang in the system if I try to do a MQTT Reconnect. While debugging I found that its coming from a call to ssl_handshake_server_async()

       

      I tried with 3.5.2 SDK and also with 4.0 (Back porting the core changes from 4.0 to 3.5.2 wrt BESL)

       

      The code snippet is

         while(1)

      {

        do

        {

        ret = aws_mqtt_conn_open( app_info.mqtt_object, mqtt_connection_event_cb );

        connection_retries++ ;

        } while ( ( ret != WICED_SUCCESS ) && ( connection_retries < WICED_MQTT_CONNECTION_NUMBER_OF_RETRIES ) );

       

       

      do

      {

      ret = aws_mqtt_app_subscribe( app_info.mqtt_object, app_info.shadow_delta_topic , WICED_MQTT_QOS_DELIVER_AT_MOST_ONCE );

      connection_retries++ ;

      } while ( ( ret != WICED_SUCCESS ) && ( connection_retries < WICED_MQTT_CONNECTION_NUMBER_OF_RETRIES ) );

       

            shadow_close();

        wiced_rtos_delay_milliseconds(1000);

      }

       

      In my shadow close I am just calling

          mqtt_network_deinit(&(((mqtt_connection_t*)app_info.mqtt_object)->socket));

          mqtt_connection_deinit((mqtt_connection_t*) app_info.mqtt_object);

       

      Am I doing any mistake. Please go through this and give some suggestions

       

      If posible can you provide me a sample application or an API which does the Reconnection for MQTT, which is like mandatory.

        1 2 3 4 Previous Next