Standardization of the server message scheduling logic

When the message arrives at the server side, it is to send a message to all clients, no concept of a group.

There should be a new group, and then join a group chat. After a group chat, a message will be sent a notification to all clients in the group chat.

Can also group chat, chat messages sent after exiting the group will not be received by the client.

Second, the class description

ConnectorHandlerChain: Handler chain connecting structure

ConnectorCloseChain: Close ligation chain structure

ConnectorStringPacketChain: receiving a configuration string, the string package encapsulation

DefaultNonConnectorStringPacketChain: Default String receiving node, do not do anything

DefaultPrintConnectorCloseChain: the close link chain structure

ParseCommandConnectorStringPacketChain: parsing command, create groups, join a group, remove a group

ForwardConnectorStringPacketChain: forwarding chain structure

Third, 类图

 

Fourth, each ClientHandler contain many processing chain structure

Fifth, join groups

Sixth, the group removed

 

Seven, within the group members to send messages, group members will receive the message, but the members of the group can not receive outside messages

Published 174 original articles · won praise 115 · views 830 000 +

Guess you like

Origin blog.csdn.net/nicolelili1/article/details/105154956