admin管理员组

文章数量:1654034

ID as the unique identifier of the message is generated by the client .  The client uses it to keep track of the message.

SessionID  generated by the server is used to identify the client and keep the correct session with the client. 

Every time the client sends message which uses different id to the server.  And the server responses with the same id.  But how does the server identify the different clients when many client connect to the server simultaneously. Furthermore, how does the client distinguish from the messages from the other clients who are chatting at the same time.  It is easily to be at a loss and confused.

To resolve the first question: When the client connects to the server, the server will create a session ID associated with the jabber id. So the session id bind with the jabber id which can the the identifier to identify the clients for the server. When the server want to send message the the specific client, it can write the XML stream to the right recipient according to the session id.

To resolve the second question: The Jabber protocol use the subelement <thread/> to help. As you know, if the client wants to chat with many other client simultaneously, each conversation will need a thread to maintain. the <thread/> can be the identifier to the moment.

Each process of identifying run at respective process.

 

本文标签: identify