The interface-driven programming model provides an imperative way to define endpoints and manage WebSocket life-cycles. When developing an endpoint you can chose the methodology that suits the use case best. You can look at how to use this model and you will be set a challenge to refactor the annotation-driven endpoint using the interface-driven method.
- [Narrator] The interface-driven programming model…provides an imperative way…to define the endpoints and manage web socket lifecycles.…When developing an endpoint,…you can choose the methodology that suits you best.…But let's turn our attention to the programmatic style.…The programmatic method…represents an endpoint by instances of the Endpoint class.…In this code snippet,…you can see that the Server Endpoint class…extends the abstract class Endpoint.…The only method that must be implemented is on Open,…in which message-handling logic is written…for the three message types: text, binary, and pong.…
Here is an example…of how to add a text-based message handler.…Now two other live cell methods…can be overwritten: onError, and onClose.…All the endpoints written using the programmatic methodology…must be resident in an application configuration class…that implements the ServerApplicationConfig interface.…The method getEndpointConfigs must be implemented…with logic that registers the URI endpoints…by adding them to the ServerEndpointConfig instance.…
Join Alex Theedom as he guides you through the lifecycle of a WebSocket connection, and discusses the Java EE WebSocket programming methodologies: annotation and programmatic. He shows how to secure and encrypt WebSocket endpoints and use simple techniques to test their implementation. In addition, he explains how to integrate the JSON-processing API and build a front-end and server based WebSocket client.
- WebSocket usage
- WebSocket lifecycle and topology
- WebSocket front end and back end
- WebSocket methodologies
- Annotation methodology and programmatic methodology
- Coding a client API
- Using the JSON Processing API
- Coding the encoder and decoder
- Building the front end
- Testing WebSocket endpoints
Skill Level Intermediate
Java Platforms Compared: SE vs EE vs MEwith Peggy Fisher25m 38s Intermediate
1. Introduction to WebSocket
2. WebSockets Front End and Back End
3. Project Application and Structure
4. Java EE WebSocket API
5. Messages and Encoding
6. Build Web Front End
7. WebSocket Security
8. Testing WebSocket Endpoints
Next steps1m 37s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.