Annotation Interface ClientEndpoint


@Retention(RUNTIME) @Target(TYPE) public @interface ClientEndpoint
The ClientEndpoint annotation a class level annotation is used to denote that a POJO is a web socket client and can be deployed as such. Similar to jakarta.websocket.server.ServerEndpoint, POJOs that are annotated with this annotation can have methods that, using the web socket method level annotations, are web socket lifecycle methods.

For example:

 
 @ClientEndpoint(subprotocols="chat")
 public class HelloServer {

     @OnMessage
     public void processMessageFromServer(String message, Session session) {
         System.out.println("Message came from the server ! " + message);
     }

 }