XMPP chat sent/received message synchronization

Scenario: I am trying to develop a web site which features a chat widget. I am using ASP.NET, C#, agsXMPP library as my tools in achieving this purpose. I use Openfire jabber server for XMPP server.

Problem: When I access the widget on the website and start chatting, I send a message with message type “chat” and thread set. I receive this message on the client in this case Spark. When I reply to this message, I see that the thread value is not the same as the one I sent? According toRFC 3921 section 2.1.2.3, The value of the element is generated by the sender and SHOULD be copied back in any replies. However, I don’t see this happening.This means, I cannot link the response with the message I sent.

The question is very similar to the one posted long back on the forums here. I cannot employ that solution here as, only one user account is used to impersonate chat conversations from multiple clients (web instances) and all of them will be chatting with the same user (jid).

Re: How do I synchronize sent/received Chat messages?Can anyone help me with what I am missing? The following is the message sent and received.

Sent Message: <message type="chat" to="saurabh@127.0.0.1/spark" id="agsXMPP_6" from="gantir@127.0.0.1/CPWebchat"><thread>d6ddeebe-f23f-4854-a315-2a9de32906b8</thread><subject>Ramjee Ganti</subject><body>An Anonymous user via the web is attempting to contact you. Name: Ramjee Ganti Email: xxx@xxx.com Issue: Sample Test</body></message>

Received Message: <message id="BTqN4-34" to="gantir@127.0.0.1/CPWebchat" from="saurabh@127.0.0.1/spark" type="chat"><body>Hello</body> <thread>42MtKq</thread><x xmlns="jabber:x:event"><offline/> <composing/></x></message>