Java Platform, Enterprise Edition: The Java EE Tutorial

18 Java API for WebSocket

This chapter describes the Java API for WebSocket (JSR 356), which provides support for creating WebSocket applications. WebSocket is an application protocol that provides full-duplex communications between two peers over the TCP protocol.

In the traditional request-response model used in HTTP, the client requests resources, and the server provides responses. The exchange is always initiated by the client; the server cannot send any data without the client requesting it first. This model worked well for the World Wide Web when clients made occasional requests for documents that changed infrequently, but the limitations of this approach are increasingly relevant as content changes quickly and users expect a more interactive experience on the Web. The WebSocket protocol addresses these limitations by providing a full-duplex communication channel between the client and the server. Combined with other client technologies, such as JavaScript and HTML5, WebSocket enables web applications to deliver a richer user experience.

The following topics are addressed here:

Close Window

Table of Contents

Java Platform, Enterprise Edition: The Java EE Tutorial

Expand | Collapse