These WebSocket samples show how to set up WebSocket Endpoints using annotations or programmatically. These samples exercise opening, reading from, writing to, and closing a WebSocket connection. Also shown is the use of encoders, decoders, the PathParam annotation, and Pong message processing.
This sample can be installed onto runtime versions 18.104.22.168 and later.
Online installation (requires 22.214.171.124 or later):
installUtility install WebsocketSample
Any missing features required by the server will be installed for you.
WebsocketSample.jarusing the download button at the top of the page and place it in the root of your server installation.
java -jar WebsocketSample.jar
Any missing features required by the server will need to be installed separately.
To run the WebsocketApp application:
bindirectory in the Liberty profile installation:
server run WebsocketSample
CWWKZ0001I: Application WebsocketApp started in XX.XX seconds.
WebsocketApp.war file contains the source and binaries for the application, and can be used to import it to Eclipse.
The application is automatically installed because it is located in the server dropins directory. Any number of applications can be installed from this location.