WebSockets Support for Java
This guide has been reviewed and reformatted for Ruk-Com Cloud PaaS. Screens may vary slightly by platform version.
Click or tap a screenshot to view it at its original size.
Objective
This guide explains how to use WebSockets Support for Java on Ruk-Com Cloud PaaS, with ordered procedures and practical verification points.
Before you begin
- Sign in with an account permitted to manage the relevant environment.
- Confirm the target environment, region and resources before saving changes.
- Create a backup or rollback plan before changing a production system.
WebSocket protocolIt was introduced to replace HTTP-based bidirectional communications as the transport layer. HTTP was not initially intended for these purposes. This new technology ensures the establishment of a TCP full-duplex connection between the client and the server where messages are transmitted instantly. WebSockets technology is designed to run on standard HTTP ports (80 and 443) and to support HTTP proxies and middleware, which represents an efficient and reliable exchange.
WebSockets combines this technology with a Shared Load Balancer and an NGINX balance node, so you can use it even without an external IP address attached to your server. The easiest way to use WebSockets for an application is to place the NGINX balancer in front of it - details can be found here.here
However, if you don't want to use this method, you can use the WebSockets protocol withJava application serversTypical implementation is done through customizing your application, which does not require any special configuration.
The only exception isGlassFishAs some server-side configuration is required for enabling WebSockets, you can follow the simple instructions below.
Environment creation and project deployment
1. Log in to Ruk-Com Cloud Dashboard with your username and password.
2. Click New Environment on the left side of the dashboard.

3. On the Topology page, switch to the tab.Javaand selectGlassfishIt's your server application. Set your desired resource limits by sliding the cloudlets bar in the vertical scaling section, then enter your environment name (e.g.java-websockets) and press the buttonCreate
4. Wait a moment for your environment to be created and appear on the dashboard.
5. You can deploy your application that supports WebSockets protocol viaarchive/URLLocally on your machine or via remote VCS storage, just add a node.Mavenin your environment topology and followthis guide
Enabling GlassFish WebSockets
The next step is to enable WebSockets for your GlassFish server application, which should be done viaAdministration ConsoleSo the necessary steps are as follows:
1. Go to the GlassFish admin panel, which can be accessed through the dashboard (by clicking the buttonAdditionallyto your env and selectAdmin panel > Login) or access via direct link. (The system will send it via email after creating the environment)
2. Open your browser and enter the credentials you received in the email to login.
3. Once logged in, go to the left menu.Configurations > gfcluster-config > Network Config > Protocols > http-listener-1Then switch to the tabHTTPAnd check the box for the Websockets Support option at the bottom.
Don't forget to pressSaveNew settings
4. Return to the dashboard andRestartGlassFish to apply changes
Once you've configured all of this, You can check the functionality of your application by clicking the button.Open in Browser