We’ve just released the latest GA version of WebSphere Application Server Liberty profile (, which contains some new features, including WebSockets support. So I thought it would be a good time to share my WebSocket planning poker application with you as an example of creating a simple real-time communication web app built on WebSockets.

It’s no secret that I’m a bit of a WebSockets fanboy. One of my first jobs in IBM as a developer was doing JavaScript development. We had a webpage polling a server endpoint for updates as there was no easy way to have full duplex communication between clients and servers; to update the content of a page from the server you have to keep asking the server if anything’s changed, which really didn’t feel right.

WebSockets solves that problem in a much more efficient way. You can hear more about WebSockets as a technology solution on our podcast:

[soundcloud url=”https://api.soundcloud.com/tracks/180885618″ params=”auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true” width=”100%” height=”450″ iframe=”true” /]

Anyway enough about WebSockets – you came here to read about the new WebSocket sample application!

The idea for this application is from my time on the Liberty development team when we were doing planning poker. The application we were using was OK but didn’t do everything I wanted it to do, so I decided to write my own. At the same time we were implementing WebSockets which looked to solve many of the technical hurdles I needed to solve when creating a webpage with real time chat support. The sample isn’t pretty – but it is functional:


The following YouTube video quickly walks through how the application works and how to deploy it. It highlights how easy WebSockets make full duplex communication between client and server.

The application code is available on our GitHub repository here: https://github.com/WASdev/sample.planningpoker – you can download the code to Eclipse and deploy it to a Liberty server straight away (just remember to add the websocket-1.0 and the servlet-3.1 features in your server xml, and make sure you have either the latest beta or the latest GA version ( of Liberty).

If you have any questions around WebSockets and how to use them in the Liberty profile please feel free to ask on Stack Overflow.

22 comments on"WebSocket sample application"

  1. Bandaru Kasaiah April 13, 2020


    We are also having the same issue while implementing web sockets in our application. Could you please describe how did you resolve it?

    • Hi, which issue is it that you’re seeing? Have you checked that you have the URL typed as “wss://” and not “was://”? Or is it something else you’re having a problem with?



  2. Hi,I want to connect to websocket server by was://
    (Secure connection ) by cant,connection failed happened,I activated SSL feature,and I can get rest request on https,but can not get websocket services,in log file of liberty not anything logged,can you help me?

    • Hi Hamid,

      Just to confirm that you’re using wss:// and not was:// as the prefix for the websocket connection? (was:// is not a protocol – wss:// is for secure websockets).


  3. (index):8 WebSocket connection to ‘ws://litianwei-pc:9080/PlanningPoker/PokerEndpoint’ failed: Error during WebSocket handshake: Unexpected response code: 404

    • Can you check that you have the websocket feature enabled in the server.xml? It’s claiming the websocket isn’t there but the server must be up as it is sending you the webpage which is trying to connect to the websocket.

      • How to enable server.xml functionality in the profile of websocket

        • In your server.xml make sure that you have the following line in the featureManager’s list of features:


  4. Is there a recommended Java client that works with Liberty’s WebSockets? I’m trying Tyrus which worked a little bit to start but now I’m seeing nio and ssl errors.

  5. […] Liberty profile you can use web sockets in your Java applications. This allows sending events from the server to […]

  6. Hi Tom,

    Thanks for that walkthrough!

    Can some configurations in web.xml, instead of server.xml , be used for enabling websocket in a web application?

    Or to put it straight, can a non-Liberty profile be configured for WebSockets?


Join The Discussion

Your email address will not be published. Required fields are marked *