               if(c=='@'){
                 if(Record!="@"){
                   Record.toCharArray(msg, Record.length()+1);
-                  mqttClient.publish(mqttTopic, msg);
+                  mqttPublishRoutine(0);
+                  mqttClient.disconnect();
+
+                  //mqttClient.publish(mqttTopic, msg);
                   //sent the same msg to partner which may monitor this topic, current work around
                   //these delay msg may cause problem to partner, not send it now.
                   //mqttClient.publish(mqttTopicSelf, msg);

  
  Serial.print("-----Loop ID: ");
  Serial.print(loop_cnt);
  loop_cnt++;
  Serial.println(" -----");
  // GPS  

void mqttSubscribeRoutine(){
  mqttClient.subscribe((char*)mqttTopicSelf);
  mqttClient.subscribe((char*)mqttTopicPartner);

  Serial.print("Subscribing ");
  Serial.println(mqttTopicSelf);
  Serial.print("Subscribing ");
  Serial.println(mqttTopicPartner);
}
#else
void mqttSubscribeRoutine(){}
#endif

void mqttPublishRoutine(int bPartner){
      mqttClient.publish((char*)mqttTopic, msg);
      //delay(100);
#if ALARM_ENABLE == 1
      //sent the same msg to partner which may monitor this topic, current work around
      if(bPartner){
        mqttClient.publish((char*)mqttTopicSelf, msg); 
      }
#endif
      mqttClient.loop();
      Serial.println("MQTT sending");
  
}
String stringTopicCmp = "";
// callback to handle incomming MQTT messages
void msgCallback(char* topic, byte* payload, unsigned int len) { 
