title: XMPPFramework - How to Create Message / Conversation Thread
body: <p>I am working on the iOS chat client by using XMPPFramework ( <a href="https://github.com/robbiehanson/XMPPFramework" rel="nofollow">https://github.com/robbiehanson/XMPPFramework</a> ), can anyone please help me with the chat and message.
  I use Spark ( <a href="http://www.igniterealtime.org/projects/spark/index.jsp" rel="nofollow">http://www.igniterealtime.org/projects/spark/index.jsp</a> ) to test my iOS chat client. </p>
  
  <p>I find out that message XML format send by Spark in the Openfire server log is following:</p>
  
  <pre><code>&lt;message id="nBT3N-161" 
           to="aaa@demo.com/7beebb67" 
           from="bbb@demo.com/Spark 2.6.3" 
           type="chat"&gt;
      &lt;body&gt;testing message ...&lt;/body&gt;
      &lt;thread&gt;FIoMFD&lt;/thread&gt;
      &lt;x xmlns="jabber:x:event"&gt;&lt;offline/&gt;&lt;composing/&gt;&lt;/x&gt;
  &lt;/message&gt; 
  </code></pre>
  
  <p>Message in the XML format has id :</p>
  
  <pre><code>id="nBT3N-161"
  </code></pre>
  
  <p>and thread id :    </p>
  
  <pre><code>&lt;thread&gt;FIoMFD&lt;/thread&gt;
  </code></pre>
  
  <p>and other info :</p>
  
  <pre><code>&lt;x xmlns="jabber:x:event"&gt;&lt;offline/&gt;&lt;composing/&gt;&lt;/x&gt;
  </code></pre>
  
  <p>But, .. when I use XMPPSteam to send message, the message XML format in the Openfire log is following :</p>
  
  <pre><code>&lt;message type="chat" 
           to="bbb@demo.com/Spark 2.6.3" 
           from="aaa@demo.com/7beebb67"&gt;
      &lt;body&gt;tttttttttttttttt&lt;/body&gt;
  &lt;/message&gt;
  </code></pre>
  
  <p>the message XML format does not include the message id, thread id and xmlns information. My code is following :</p>
  
  <pre><code>- (IBAction)didSendingMessage:(id)sender
  {
      NSString *messageStr = self.messageTextField.text;
      if([messageStr length] &gt; 0) {
          NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
          [body setStringValue:messageStr];
  
          NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
          [message addAttributeWithName:@"type" stringValue:@"chat"];
          [message addAttributeWithName:@"to" stringValue:@"bbb@demo.com/Spark 2.6.3"];
          [message addChild:body];
  
          [imManager.xmppStream sendElement:message];
          self.messageTextField.text = @"";
  
         [self.tView reloadData];
      }
  }
  </code></pre>
  
  <p>Does I miss something or did something wrong? How do I generate those information ( ex: message id, thread, xmlns .. ) in the message ?</p>
  
  <p>Or how do I create a message threading or conversation thread ?</p>
  
  <p>Does XMPPFramework has something like <code>ChatManager</code> to <code>createChat</code> in the <code>asmack</code> (<a href="https://github.com/Flowdalic/asmack" rel="nofollow">https://github.com/Flowdalic/asmack</a>) ?</p>
  
  <p>Thanks</p>