A WebSocket message can adopt a variety of types including text, binary and pong. You canlook at how to implement the WebSocket message encoders and decoders and what methods must be overridden in the implementation of the different message type's interfaces. You can look at the flexibility that the different message types afford us and how the text type can be used with JSON-Processing.
- [Narrator] Endcoders and decoders allow custom Java types…to be used to represent messages from and to clients.…An encoder translates a Java custom type into a form…that can be transmitted as a WebSocket message…and a decoder performs the reverse function.…To create an encoder, you must implement…one of these interfaces, depending on whether the WebSocket…message should be text or binary.…There are equivalent interfaces…for TextStream and BinaryStream.…For a Java custom type, you would choose to implement…the text subclass like so…and in doing so, you specify the generic type…of the custom Java type.…
In this case, the custom type is message.…You are then required to implement three methods.…The init method is used to make configurations…to the endpoint for the endpoint…of this coder will be used with.…And the destroy method is called when the encoder…is about to be destroyed and is used to close…any resources that the encoder uses.…Now, the encode method is where all the fun happens.…This method receives an instance of the custom Java type.…
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.