WebSockets in Jelastic: Better, Faster, Stronger

By | August 20, 2012

Would you like to make your application faster, more efficient, and more scalable? We are very happy to tell you about another great and useful add-on within Jelastic Cloud PaaS – WebSockets.

“WebSockets?”, you say. Just take a look on the benefits you can get with them, and you will agree.

WebSockets are part of a long expected evolution in client/server web technology. They allow a long-held single TCP socket connection to be established between the client and server which allows for bi-directional, full-duplex messages to be instantly distributed with little overhead, resulting in a very low latency connection.

Benefits of using WebSockets:

  • Reducing unnecessary network traffic and latency using full-duplex through a single connection
  • Streaming through proxies and firewalls, supporting simultaneously upstream and downstream communication
  • Backward compatible with the pre-WebSocket world by switching from an HTTP connection to WebSockets

Let’s deploy a sample application that uses WebSockets you that you can see how easy it is.

Create an environment

1. Go to jelastic.com and sign up if you haven’t done it yet or log in with your Jelastic credentials by clicking the Sign In link on the page.

2. Click Create environment to set up a new environment in Jelastic.

3. In the Expert environment topology window, select GlassFish as your application server and switch on Public IPv4 for it. Pick Maven as your build node and type your environment name, for example, web-socket-test. Then click Create.

In a minute, your environment with both GlassFish and Maven will be created and appear in the environment list.

Build and deploy a project

1. Click on Add project button for Maven.

2. In the dialog, navigate to Git tab (or SVN tab). Specify your project name, Path to your project, Branch, Login and Password of your repository, the name of your Environment, Context in which you will deploy your project and click Add. We use a simple chat application as an example. You can find this project here.

Now your project is successfully added.

3. Click on Build and deploy button for your project.

This process can take several minutes. Your project will appear in the context that you have specified and you will see a war file in the Deployment Manager.

Configure GlassFish

1. Go to GlassFish admin panel and log in with credentials, which Jelastic sent you, when you created the environment.

2. Navigate to Configurations -> gfcluster-config -> Network Config -> Protocols -> http-listener-1, select HTTP tab and enable Websockets Support. Don’t forget to save the changes!

3. Restart GlassFish.

Start an application

Open your application in a web browser and ensure that it works fine.

Done. Have you ever deployed an app with WebSockets easier than that?

Subscribe to get the latest updates