Top Description Methods
jakarta.websocket

public @Interface ClientEndpoint

extends Annotation
Annotations
@Retention:RUNTIME
@Target:TYPE
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

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);
    }

}

Author
dannycoward

Method Summary

Modifier and TypeMethod and Description
public Class<? extends ClientEndpointConfig.Configurator>

Returns:

the custom configurator class, or ClientEndpointConfigurator.class if none was provided in the annotation.
configurator
()

An optional custom configurator class that the developer would like to use to provide custom configuration of new instances of this endpoint.

public Class<? extends Decoder>[]

Returns:

the array of decoders.
decoders
()

The array of Java classes that are to act as Decoders for messages coming into the client.

public Class<? extends Encoder>[]

Returns:

the array of decoders.
encoders
()

The array of Java classes that are to act as Encoders for messages sent by the client.

public String[]

Returns:

the array of names of the subprotocols.
subprotocols
()

The names of the subprotocols this client supports.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

configuratorback to summary
public 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:Class<? extends ClientEndpointConfig.Configurator>

the custom configurator class, or ClientEndpointConfigurator.class if none was provided in the annotation.

decodersback to summary
public Class<? extends Decoder>[] decoders()

The array of Java classes that are to act as Decoders for messages coming into the client.

Returns:Class<? extends Decoder>[]

the array of decoders.

encodersback to summary
public Class<? extends Encoder>[] encoders()

The array of Java classes that are to act as Encoders for messages sent by the client.

Returns:Class<? extends Encoder>[]

the array of decoders.

subprotocolsback to summary
public String[] subprotocols()

The names of the subprotocols this client supports.

Returns:String[]

the array of names of the subprotocols.