Practical development of comet applications

Source: Internet
Author: User
Tags websphere application server

Comet is a new Web application architecture. In applications developed based on this architecture, the server actively sends messages to the client in asynchronous mode.ProgramPush data without explicitly sending requests from the client. The comet architecture is very suitable for event-driven web applications and applications that require strong interactivity and real-time performance, such as stock exchange analysis, chat rooms, and online web games. Based on the introduction of the comet architecture, this article describes in detail how to use WebSphere Application Server Feature Pack for Web 2.0 and dojo to develop comet-based applications, and provides two specific examples.

Introduction to comet and Related Technologies

Comet refers to the architecture of a Web application. In this architecture, client programs (usually browsers) do not need to explicitly send requests to the server, the server sends the data to the client asynchronously when the data changes, so that the client can update the user interface in time to reflect the data changes on the server.

This architecture is different from traditional web applications and emerging Ajax applications. In traditional Web applications, the client initiates a request, and the server generates the entire HTML page and submits it to the client for processing. In Ajax applications, the client initiates a request, but the server usually returns data in XML or JSON format. Then, the client uses the data to locally update the page. The comet architecture is very suitable for event-driven web applications and applications that require strong interactivity and real-time performance. Examples of such applications include stock transaction analysis, chat rooms, and online web games.

A comet-based Web application uses the HTTP persistent connection between the client and the server as the data transmission channel. When the server data changes due to external events, the server can push the relevant data to the client in a timely manner. Generally, there are two strategies for implementing persistent connections:

HTTP streaming)

In this case, the client opens a single persistent HTTP connection with the server. The server sends the data through this connection, and the client incrementally processes them.

HTTP long polling)

In this case, the client sends a request to the server and opens a connection. This connection is closed only after the server receives data. After the server sends the data, it immediately closes the connection. The client immediately opens a new connection and waits for the next data.
Introduction to WebSphere Application Server Feature Pack for Web 2.0

WebSphere Application Server Feature Pack for Web 2.0 is a solution supported by IBM to Create Ajax-based applications and mashups on WebSphere Application Server. In addition to Ajax development tools, this feature package also includes server-side enhancements to support general Web 2.0 application modes. This feature package provides many enhancements for developing Web 2.0 applications. There are three main aspects: connectivity between Web 2.0 and SOA, Ajax message processing, and Ajax development toolbox. For more information about this feature package, see reference resources. This feature package is applicable to different versions of Websphere Application Server and WebSphere Application Server community edition.

Introduction to dojox. cometd

Alex Russell, founder of dojo, first proposed the word "Comet. The dojo Foundation proposed the Bayeux protocol to standardize the communication between clients and servers in Comet applications. For more information about the Bayeux protocol, see reference resources. Dojox. cometd implements the client part of The Bayeux protocol and uses HTTP long polling as the data transmission channel.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.