XMPP chat sent/received message synchronization

2019-09-19 04:20发布

问题:

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 to RFC 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.

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@example.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>

回答1:

The RFC says the "thread" element SHOULD (see http://tools.ietf.org/html/rfc2119) be returned in replies. It may be that this client just didn't implement it.