Let's do the IM together, do the IM
I had IM-related research because I needed my work before, but I felt very dissatisfied with what I was doing. So now I want to repeat it again and record the entire record process by the way.
First, describe the environment. The C # language of the IM server, which adopts UDP protocol and can transmit a maximum of 8 K content. The message implementation process is relatively simple to get the message to process the message. For example, if we send the message to another client in the business logic, the business logic of the Message Server is complete. OK. Maybe you think this is too simple. It is totally different from the logic of the Message Server. However, the essence of the message server is that it receives the message and then forwards it. However, when there are too many messages, we are bound to make various judgments in our business logic, which are used to determine the message classification type, treat them differently, and proceed with the next step. In this case, for convenience, a concept is generally introduced in the Message Server, called message routing, mainly to determine the message type after obtaining the message, then, different types of messages are pushed to the specific processing logic. In this step, the Message Server diagram should be slowed down. For example, at this time, a simple framework has been set up, and we have achieved different message communication, such as login, sending messages, and obtaining their own information. However, the current message mechanism is incomplete and relies too much on the network. Therefore, we need a mechanism to record the messages we send. Message lifecycle: the message lifecycle is completed in two places. The sender sends the message, the receiver receives the message, processes and sends the receipt, and the client receives the receipt to complete the message. The sending end cycle starts when the message is sent. within the specified time, the receipt of the message is the response; otherwise, the message times out (after the message times out, the client no longer responds to the message ). For example, if the acceptor completes the lifecycle of a message after receiving the message until the message processing is completed. There should be nothing in the framework to stop us from moving forward, and the rest is basically the business logic. Log on, get the current logon user, and forward messages. A small IM system has been completed. First, the semi-finished products of this project will gradually become open-source and cannot be commercially available without permission. It is only used for learning and understanding IM.