目 录
基于MQTT的信息推送系统设计与实现
摘 要
互联网技术的飞速发展与深入应用,将人们带入了信息爆炸时代。各类应用(如移动社交应用、控制系统、Web网络监控应用和网页聊天等)希望在用户查找数据时能获得更好的用户体验。为适应实际应用中对信息获取的及时性、交互性强、低成本等要求,需要采用服务器消息推送来代替传统的信息拉取的方式将用户感兴趣的信息推送给用户。同时,消息推送平台已成为各种复杂应用软件开发的主要技术支撑平台。
在其中的教育行业,师生间存在信息传递不及时、沟通不畅等问题,影响着教学质量和管理效率,因此提出能及时、可靠、精准地推送多媒体信息的需求,本项目正是根据某教育学院客户这样的需求提供的一种解决方案。通过对客户需求的分析以及国内外相关案例和技术的研究,论证需求的可行性,设计出“基于MQTT(Message Queuing Telemetry Transport)协议的信息推送平台系统的设计与实现”的方案,该系统结合B/S结构与C/S结构的架构模式,将总体架构细分为服务端、代理端和客户端三个子系统,采用基于MQTT协议的推送技术来实现信息的传播,突出及时、精准送达信息的特点。其中,服务端分为前端服务器和Web服务器,前者使用Nginx,提供反向代理和负载均衡的功能,后者采用Play Framework框架来开发,服务端的数据管理由MySQL数据库提供支持;代理端基于C语言版的Mosquitto工程来开发,从而提高开发和运行效率;客户端采用Android系统平台开发,从而支持使用最广泛的智能终端用户群。
在开发工具方面,服务端和客户端工程在Eclipse上进行开发,代理端工程开发采用Sublime Text 2。在功能定义方面,服务端子系统具有内容管理、用户管理、处理反馈信息等功能;代理端子系统具有发布消息、持久连接用户终端等功能,提供对MySQL数据库操作的支持,改进MQTT协议从而实现个性化消息推送机制;客户端子系统具有消息接收、消息展示、信息反馈、附件下载等功能。通过对本系统的一系列测试,结果证明实现的功能符合要求,系统的可用性得到验证,系统总体上满足客户的需求。本项目的开发应用,使得MQTT协议的应用领域得到扩展,也使得本系统成为行业信息推送领域的成功解决方案之一。
关键字:消息推送;MQTT协议;客服端;服务端
ABSTRACT
The rapid development and deep application of Internet technology bring people into the era of information explosion. All kinds of applications (such as mobile social applications,control systems,Web network monitoring applications and web chat) hope to get a better user experience when users look for data. In order to meet the requirements of timeliness,interactivity and low cost of information acquisition in practical applications,it is necessary to use server message push instead of traditional information pulling to push the information of interest to users. At the same time,the message push platform has become the main technical support platform for the development of various complex application software.
In the education industry,there are problems such as information transmission and communication between teachers and students,which affect the quality of teaching and management efficiency,so the demand for timely,reliable and accurate push of multimedia information is put forward. This project is a solution based on the needs of a certain college of education customers. Based on the analysis of customer demand and the research of relevant cases and techniques at home and abroad,the feasibility of demand is demonstrated,and the design and implementation of the information push platform system based on the MQTT queueing Teleport protocol is designed This system combines the architecture mode of B/S structure and C/S structure,divides the overall architecture into three subsystems: server,agent and client,and uses push technology based on MQTT protocol to realize the dissemination of information,highlighting the characteristics of timely and accurate delivery of information. The server is divided into front-end server,which uses Nginx,to provide reverse proxy and load balancing function,and Web server,which is developed by Play Framework framework,and server-side data management is supported by MySQL database. Cheng to develop,thus improving the development and operation efficiency;the client uses the Android system platform to develop,thus supporting the most widely used intelligent end user group.
On the development of tools,server-side and client-side projects are developed in Eclipse,and agent-side projects are developed in Sublime Text 2.. On the aspect of function definition,the service terminal system has the functions of content management,user management,processing feedback information,etc. The agent terminal system has the functions of publishing messages,connecting user terminals persistently,providing support for MySQL database operation,improving MQTT protocol and realizing personalized message push mechanism. Through a series of tests on the system,The results show that the realized function meets the requirements,the availability of the system is verified,and the system generally meets the needs of customers. Development and application of this project make the application field of MQTT protocol expand,also make this system become one of the successful solutions in the field of industry information push.
Keywords: message push;MQTT protocol;customer service;server