The WebSocket protocol was implemented to replace existing bi-directional communication mechanisms that use HTTP as the transport layer, since HTTP was not initially designed for these purposes. This new technology ensures establishment of a single full-duplex TCP connection between client and server, where messages are instantly transmitted with little overhead, both upstream and downstream at once. At the same time, WebSockets technology is designed to work over the standard HTTP ports (80 and 443) and to support HTTP proxies and intermediaries, representing a trade-off between efficiency and reliability
The platform provides advanced, comprehensive WebSockets support by integrating this technology into the Shared Load Balancer and the NGINX balancer node, so you can use it even without an external IP address attached to your server. The easiest way to configure WebSockets support for your application is to place an NGINX balancer in front of it; the detailed workflow can be seen here.
Nevertheless, if this method contradicts your requirements, the WebSockets protocol usage is also supported by all the Java application servers, provided on the platform. Herewith, implementing WebSockets for Java is commonly done by configuring your application and does not require any special server configuration; you are only limited by your current programming skills, persistence, and imagination.
The only exception is GlassFish, which requires some server-side configuration to enable WebSockets support. So, let’s find out how this can be done – just follow the simple instructions below.
Create an Environment and Deploy a Project
1. Log into the platform dashboard with your login and password..
2. Click New environment at the top-left section of the dashboard.

3. In the opened environment topology window, switch to the Java tab and select GlassFish as your application server. Then set resources limits for it with the help of cloudlet sliders in the Vertical scaling wizard section, type your environment name (for example, java-websockets) and click Create.

4. In a few minutes, your environment with the GlassFish server will be created and will appear on the dashboard.

5. Now, you can deploy your application, which requires the WebSockets protocol support, to your environment. This can be done via local archive/URL, or, if you prefer to use the remote VCS repository, simply add the Maven node to your environment topology and follow this guide.
As a result, your deployed application will be listed in the appropriate panel column:

Enable GlassFish WebSockets Support
The next step you need to do is to activate the WebSockets support for your GlassFish application server. This should be performed through its Administration Console, so the required steps are the following:
1. Navigate to the GlassFish admin panel, which can be accessed through the dashboard (by clicking the Additionally button for this server in your environment and choosing the Admin panel > Login option in the appeared list) or direct link (which the platform sent you via email after the environment creation).

2. In the newly opened browser tab, specify the credentials you’ve received in the corresponding email and proceed with the Login button.

3. Once entered, navigate to the Configurations > gfcluster-config > Network Config > Protocols > http-listener-1 section within the left-hand menu. Then switch to the HTTP tab and tick the WebSockets Support checkbox at the bottom of the page.
Don’t forget to save the new settings!

4. Return to your dashboard panel and Restart GlassFish to apply the changes.

As all the configurations are done now, you can Open your application in Browser and ensure that it works fine. Enjoy!