Tomcat 7 WebSocket implementation (I)

Source: Internet
Author: User

Tomcat 7 WebSocket implementation (I)

Author: chszs, reprinted with note. Blog homepage: http://blog.csdn.net/chszs

This article covers the following:

1) evolution of Web communication

2) WebSocket

3) Implementation of WebSocket in Apache Tomcat 7

4) How to develop the WebSocket feature using jargery

The WebSocket implementation is introduced in Tomcat 7. Next we will first understand the advantages and disadvantages of WebSocket, and then briefly introduce the WebSocket Implementation of Apache Tomcat 7.

The evolution of WebSocket:


To implement two-way HTTP Communication in Tomcat 6, you need to use the Comet processing module of Tomcat. Comet has the following limitations:

1) HTTP is a request/response protocol rather than a two-way protocol.

2) proxy and other intermediate media won't work well.

3) Only data packets in a certain direction are transmitted at any given time.

4) It is difficult for Servlet developers to use multithreading.

Servlet 3.0 introduces a new feature: asynchronous Servlet. We will compare it with the client's Ajax call. The asynchronous Servlet suspends the request until the response is ready for delivery, without using the worker thread in the container. WebSockets is another technology that tries to standardize. It supports asynchronous, event-driven, and full-duplex communication over HTTP.

WebSocket provides the following features:

1) provides full-duplex communication over HTTP by upgrading/switching the HTTP protocol

2) Message/frame-based communication

3) can work with agents and intermediary Media

4) do not work with the proxy or intermediary media.

Advantages of WebSocket:

1) WebSocket is ideal, and the client and server no longer need long-term sessions.

2) WebSocket is a full-duplex communication over the HTTP protocol.

3) Because WebSocket is the Protocol over TCP after the HTTP handshake initialization, you only need to do two things:

Send message

Receive messages


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.