Developing WebSocket applications in Liberty

You can configure the Liberty to use the WebSocket protocol to enable applications to communicate by using a full duplex connection.

About this task

To configure a Liberty server to run an application that is enabled for WebSocket 1.0, you must set the websocket-1.0 feature for WebSocket 1.0 or the websocket-1.1 feature for WebSocket 1.1.


In addition to the Websocket API which is defined in JSR 356 (Java API for WebSocket version 1.1), an API was added to the WebSphere implementation which allows a servlet or filter to request that the current HTTP Request be "upgraded" to start a WebSocket session. This new API is documented here:

Interface WsWsocServerContainer

Websocket endpoints can make use of templates to match an endpoint to a URI. URIs that should not map to websocket endpoints, even though they match a websocket template, can also be used by a web application. The distinction between mapping a websocket endpoint to a URI or allowing the URI to be treated as a "non-websocket" HTTP Request, is made by the presence or absence of an "Upgrade" header with a value of "websocket" in the HTTP Request.

For information about developing WebSocket applications by using WebSphere Developer Tools, see Developing WebSocket applications.