节点文献
基于服务器端Push的Web框架设计与实现
Design and Implementation of a Web Framework Based on Server Side Push
【作者】 陆晓春;
【导师】 李善平;
【作者基本信息】 浙江大学 , 计算机应用, 2007, 硕士
【摘要】 Web 2.0的应用日益广泛,Ajax在其中起到了非常重要的作用。它提供与服务器异步通讯的能力,让用户从请求/响应的循环中解脱出来,从而带来了更为自然的浏览体验。但在实际开发中,不少应用对实时性提出了更高的要求,在这样的需求下一种新的技术诞生了。Comet建立在Ajax的基础之上,但对Ajax的现有实现进行了创新。它改变了浏览器从服务器端Pull数据的惯例,转而由服务器直接Push数据给浏览器。双向沟通建立在服务器和客户端之间——服务器端产生的异步事件可以直接发送给客户端;而由事件驱动,客户端可以即时响应服务端的请求。B/S构架向基于C/S结构的程序跨近了一大步,因而可以实现之前无法做到的应用。本文详细论述了这一技术,以实时性为目的,设计并实现一个基于J2EE的框架,以验证此理论的可行性。设计上以实时流协议为基础,确立了控制通道和数据通道的概念,制定了一套自己的指令与协议。开发包括服务器端和客户端两方面:遵从指定的协议,服务器控制并维持与客户端的连接并以HTTP流传送交互数据——从功能以及扩展性、可维护性出发,服务器端划分成会话管理、事件分发、数据源和事件钩子四个模块;同时在客户端实现一个JavaScript引擎,发送指令、接收流数据并分发事件。最后本文列举了几个应用实例,包括将Push技术与SOA结合,设计了一个实时汇率发布的应用,以及将其推广到现有的BBS系统上,对浙大的飘渺水云间Web提出了更新,从实践上论证模型框架的可靠性与准确性;并分析了框架的应用前景,指出目前存在的不足与问题,为下一步的研究和实现奠定了坚实的基础。
【Abstract】 "Web 2.0" is widely used today and applications based on it soar, in which Ajax plays an important role. It provides the ability to asynchronously communicate to the server, extricating users from the traditional request / response cycle, thereby brings a more natural browsing experience. But through practical development, more and more applications demand the capability of real-time interactions, and a new technology was born in answer to the needs.It is the Comet technology that innovates upon the existing Ajax realization and explores a new world. It has changed the browser from pulling data from the server, and instead the server pushes data directly to the browser. A two-way communication is established between them. Asynchronous events on the server side can be sent directly to the client, and using event-driven architecture the client can immediately respond to the events from server. As a result, applications based on B/S structure become more like as ones based on C/S structure, which was totally impossible to achieve before.This paper discusses the Comet technology in detail, designs and implements a framework using J2EE technology to verify the feasibility of this theory for real-time interactions. I designed my protocol based on Real-Time Streaming Protocol, which contains the concepts of a Control Channel and a Data Channel. Development will focus on both server and client sides: complying with the protocol specified, the server holds and controls the connection to the client, using HTTP Streaming to interchange data. To promote scalability and maintainability, the server framework is divided into four portions per functionalities: Session Management, Event Dispatch, Data Feed and Event Hook modules. On the client side, a JavaScript engine is implemented to send commands, receive streaming data and dispatch events. At last this paper lists several practical applications to examine the reliability and accuracy of the framework, points out some unsolved insufficiency and shortage and proposes some advices for future researches.
【Key words】 Ajax; Comet; Event-driven Architecture; HTTP Streaming; J2EE;
- 【网络出版投稿人】 浙江大学 【网络出版年期】2007年 02期
- 【分类号】TP311.10
- 【被引频次】8
- 【下载频次】276