Java Reference
In-Depth Information
The sample Echo application in action
Before looking at the generated source code, let's take a quick look at the sample
Echo application in action. We can run it as usual by right-clicking on the project
and selecting Run .
A few seconds after clicking on Run , the browser pops up and automatically runs
the application.
The text Hello WebSocket! Is automatically prepopulated on the text input field.
Clicking on the button labeled Press me sends the text to a WebSocket server
endpoint, which simply sends the text back to the client. We can see the results
of this at the bottom of the preceding screenshot.
The sample project consists of two files: an index.html file containing JavaScript
functions that generate WebSocket events and a corresponding Java class that
processes these events. We'll discuss the Java class first, and briefly cover the
client-side JavaScript.
Search WWH ::

Custom Search