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.
WebSocket methodologies
From the course: WebSocket Programming with Java EE
WebSocket methodologies
- [Instructor] The Java EE API for WebSocket is specified in JSR 356 and has a rich set of features. The WebSocket API provides two methodologies for implementing WebSocket endpoints. Programmatically, by extending the endpoint class and overriding its lifecycle methods. And by decorating in class with the appropriate annotations. The programmatic method represents an endpoint by instances of the endpoint class. The OnOpen method is overwritten and message handling logic is written. Two other lifecycle methods can be overwritten, onError and OnClose. And all the endpoints are registered and URI is defined in an application configuration class. And messages are sent by calling a send method on the client session. The annotation methodology is arguably much simpler, as all WebSocket configuration happens in the same class and is done by passing metadata to the appropriate annotation. So you annotate a class ServerEndpoint and specify the endpoint's URI. Optionally, you can specify a…
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)
-
-
-
-
-