Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 3.05 KB

README.adoc

File metadata and controls

63 lines (48 loc) · 3.05 KB

websocket-hello: A simple WebSocket application

The websocket-hello quickstart demonstrates how to create a simple WebSocket application.

What is it?

The websocket-hello quickstart demonstrates how to create a simple WebSocket-enabled application in {productNameFull}. It consists of the following:

  • A JavaScript enabled WebSocket HTML client.

  • A WebSocket server endpoint that uses annotations to interact with the WebSocket events.

  • A jboss-web.xml file configured to enable WebSockets

WebSockets are a requirement of the {javaVersion} specification and are implemented in {productName} {productVersion}. They are configured in the undertow subsystem of the server configuration file. This quickstart uses the WebSocket default settings, so it is not necessary to modify the server configuration to deploy and run this quickstart.

Note
This quickstart demonstrates only a few of the basic functions. A fully functional application should provide better error handling and intercept and handle additional events.

Building and running the quickstart application with a {productName} server distribution

Access the Application

The application will be running at the following URL: http://localhost:8080/{artifactId}/.

  1. Click on the Open Connection button to create the WebSocket connection and display current status of Open.

  2. Type a name and click Say Hello to create and send the Say hello to NAME message. The message appears in the server log and a response is sent to the client.

  3. Click on the Close Connection button to close the WebSocket connection and display the current status of Closed.

  4. If you attempt to send another message after closing the connection, the following message appears on the page:

    WebSocket connection is not established. Please click the Open Connection button.