javax.websocket

Annotation Type ClientEndpoint


  • @Retention(value=RUNTIME)
     @Target(value=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 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);
         }
    
     }
     
    Author:
    dannycoward
    • Element Detail

      • subprotocols

        public abstract String[] subprotocols
        The names of the subprotocols this client supports.
        Returns:
        the array of names of the subprotocols.
        Default:
        {}
      • decoders

        public abstract Class<? extends Decoder>[] decoders
        The array of Java classes that are to act as Decoders for messages coming into the client.
        Returns:
        the array of decoders.
        Default:
        {}
      • encoders

        public abstract Class<? extends Encoder>[] encoders
        The array of Java classes that are to act as Encoders for messages sent by the client.
        Returns:
        the array of decoders.
        Default:
        {}
      • configurator

        public abstract Class<? extends ClientEndpointConfig.Configurator> configurator
        An optional custom configurator class that the developer would like to use to provide custom configuration of new instances of this endpoint. The implementation creates a new instance of the configurator per logical endpoint.
        Returns:
        the custom configurator class, or ClientEndpointConfigurator.class if none was provided in the annotation.
        Default:
        javax.websocket.ClientEndpointConfig.Configurator.class

Document created the 11/06/2005, last modified the 18/08/2025
Source of the printed document:https://www.gaudry.be/en/java-api-javaee-rf-javax/websocket/clientendpoint.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com/en/java/, Annotation Type ClientEndpoint

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author of this site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.