+

Search Tips   |   Advanced Search

WebSockets

The WebSockets protocol enables a web browser or client application and a web server application to communicate using one full duplex connection.

HTTP was not designed for long-lived, real-time, full duplex communication between two applications. In many instances, a user's web server application or servlet wants to communicate with a client browser or application in a long-lived, real-time, full duplex conversation. In other words, the two applications want to freely read and write data back and forth. An example of this type of application is one that constantly displays changing currency exchange rates on the web browser of a stock trader. Current solutions that involve existing HTTP technology to accomplish this type of communication are cumbersome and inefficient. HTTP solutions, for constant two-way communication between a browser and a server, mostly consists of either polling or two open HTTP connections that handle one-way traffic only, or both.

WebSockets uses a standard HTTP request-response sequence to establish a connection. When the connection is established, the WebSocket API provides a read and write interface for reading and writing data over the established connection in an asynchronous full duplex manner. WebSockets also provides an interface for asynchronously closing the connection from either side.

Because WebSockets uses a standard HTTP request-response sequence to establish a connection, the connection initiation connects though firewalls and proxies in the same manner as an HTTP connection. WebSockets requires full duplex communication, including simultaneous reads and writes on the same connection. v8.5.5.3 and later of the WebSphere web server plug-in support full duplex communication, but other firewalls and proxies might require modification to enable this support. WebSockets can also use SSL for secure connections and transmission of data. This protocol uses SSL in the same way that the HTTP protocol uses SSL.

The Liberty profile WebSocket feature implements the following specifications:

We can download sample programs that implement the WebSocket protocol from WASdev.net. For a walkthrough of using WebSockets on the Liberty profile, see WebSocket sample application on WASdev.net.


Subtopics


Parent topic: WebSphere Application Server Liberty Core: Overview