WebSockets Support for Java

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.

1. Log into the platform dashboard with your login and password..

2. Click New environment at the top-left section of the dashboard.

WebSockets Java new env

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.

WebSockets Java env wiz

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

WebSockets Java env created

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:

WebSockets Java deployed

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).

WebSockets Java admin panel

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

WebSockets Java login

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!

WebSockets Java webs supp

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

WebSockets Java restart

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

Share this:
FacebookXWhatsAppTelegramLinkedInGmailCopy Link
Updated on March 10, 2026
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support