摘要
随着互联网技术的不断发展,Web技术在各个领域得到了不同程度的运用,人们对于Web应用的实时性提出了更高的要求,HTML5 WebSocket协议因此得到了广泛的关注。通过对基于HTTP的传统Web实时通信方案进行分析,针对其中的不足与缺点,深入介绍了基于HTML5 WebSocket协议的实时通信机制以及相对于传统方案的优势,并通过使用Node.js的Express框架和HTML5 WebSocket协议的第三方应用程序编程接口Socket.io类库实现了一个基于WebSocket协议的Web应用。经实验表明,所描述的研究能成功地在客户端和服务器端完成基于HTML5 WebSocket协议的实时通信过程并建立连接。
With the development of Internet technology,Web technology has been applied in various fields,and people put forward higher requirements to the real-time of Web application. So HTML5 WebSocket protocol gets a lot of attention. Through the analysis of the traditional Web real-time communication scheme based on HTTP,for the deficiencies and disadvantages of HTTP,this paper introduces the real- time communication mechanism based on the HTML5 WebSocket protocol and the advantages compared with the traditional solutions. By using the Express framework of Node. js and third party application programming interface Socket. io library of HTML5 WebSocket protocol,it implements a Web application based on We Bsocket protocol. The experiment shows that it can successfully complete the process of real-time communication based on the HTML5 WebSocket protocol and establish a connection between the client and server.
出处
《微型机与应用》
2016年第10期88-91,共4页
Microcomputer & Its Applications
基金
华侨大学研究生科研创新能力培育计划项目(1400222001)