摘要
基于ApacheKafka消息代理框架使用成本高和基于私有协议导致的兼容性不好等问题,提出了以WebSocket作为通信协议的发布订阅机制实时消息系统的设计方案。以聊天系统为例,使用Socket.IO实现后端服务,使用Redis的发布订阅机制来构建实时消息系统,同时提出了全局ID、消息令牌等模块的设计思路。首先进行了方案技术选型,具体包括消息传递模型与协议选型、后端框架选型,然后阐述了系统架构设计和主要模块实现,最后进行了系统测试。测试结果表明系统运行稳定,实时连接性能良好。
Based on the high cost of Apache Kafka message proxy framework and the poor compatibility caused by private protocol,a design scheme of publish-subscribe mechanism real-time message system with WebSocket as communication protocol is proposed.Taking the chat system as an example,using Socket.IO to implement backend services,using Redis'publish-subscribe mechanism to build a real-time messaging system,and proposing design ideas for modules such as global ID and message token.Firstly,the technical selection of the scheme is carried out,including the selection of messaging model and protocol,and the selection of back-end framework.Then,the system architecture design and the realization of main modules are expounded,and finally the system is tested.The test results show that the system runs stably and the real-time connection performance is good.
作者
邢如意
XING Ruyi(Xuzhou Finance and Economics Branch of Jiangsu Union Technical Institute,Xuzhou 221008,China)
出处
《现代信息科技》
2023年第21期28-31,35,共5页
Modern Information Technology