From the course: WebSocket Programming with Java EE
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Programmatic methodology
From the course: WebSocket Programming with Java EE
Programmatic methodology
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
WebSocket methodologies1m 52s
-
(Locked)
WebSocket functionality1m 56s
-
(Locked)
Annotation methodology2m 38s
-
Implement WebSocket lifecycles6m 37s
-
(Locked)
Configure the session5m 32s
-
(Locked)
Lifecycle logic4m 1s
-
(Locked)
Programmatic methodology1m 16s
-
(Locked)
WebSocket client API1m 37s
-
(Locked)
Code a client API6m 54s
-
(Locked)
✓ Challenge: Code programmatic endpoint31s
-
(Locked)
✓ Solution: Code programmatic endpoint1m 9s
-
(Locked)
-
-
-
-
-