Design and implementation of a secure message feeding system based on WebSocket protocol
To save the bandwidth resources of the application system and improve the reliability and security of messages received by clients,an independent message security feed system was designed to provide an open interface for the application system to call on.When a client requests a time-delayed risky business from the application system,the system first triggers a WebSocket connection with the feed system to obtain the client identification and key,and then carries the identification to initiate an hyper text transfer protocol connection with the application system again to handle the business.During the time-consuming business processing,the client does not need to maintain a long connection with the application system.Once the application system completes its business,it sends the response message,along with the client identification,to the feed system via an hyper text transfer protocol connection.The feed system packages and encrypts the response messages of multiple clients into a cipher text and feeds it to the clients,who decrypts it to get the requested business results.The feed system was implemented using the Golang language and MySQL database,and provides a generic interface that conforms to the representational state transfer(REST)architecture for external access.Functional tests results show that the client can accurately receive messages from the feed system and achieve the expected functions.