From the course: Java EE 8 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Server endpoints

Server endpoints - Java EE Tutorial

From the course: Java EE 8 Essential Training

Start my 1-month free trial

Server endpoints

- [Instructor] Java EE allows us to build web socket server endpoints using several annotations defined within the web socket API. Lets build our first server endpoint using an annotation based approach. To do that, we're going to work within our JSF project and create a new class in the com.linkedin.jsf package. So just go ahead, create a class and we're going to call this the help server socket endpoint and go ahead and create the class. And then on this class, we're going to add the server endpoint and you'll remember this is one of the web socket annotations that allow us to declare an endpoint for our web socket. Within that annotation, we need to provide a path for the web socket. In this case, it's going to be /socket/help. Now within this class, we're going to create three methods. The first is going to be onOpen and this method will be invoked when a session is opened. And then we're just going to go ahead, we'll…

Contents