@Retention(RUNTIME) @Target(TYPE) public @interface ServerEndpoint
The annotated class must have a public no-arg constructor.
For example:
@ServerEndpoint("/hello");
public class HelloServer {
@OnMessage
public void processGreeting(String message, Session session) {
System.out.println("Greeting received:" + message);
}
}
Modifier and Type | Required Element | Description |
---|---|---|
String |
value |
The URI or URI-template, level-1 (See RFC 6570) where the endpoint will be deployed.
|
Modifier and Type | Optional Element | Description |
---|---|---|
Class<? extends ServerEndpointConfig.Configurator> |
configurator |
The optional custom configurator class that the developer would like to use
to further configure new instances of this endpoint.
|
Class<? extends Decoder>[] |
decoders |
The ordered array of decoder classes this endpoint will use.
|
Class<? extends Encoder>[] |
encoders |
The ordered array of encoder classes this endpoint will use.
|
String[] |
subprotocols |
The ordered array of web socket protocols this endpoint supports.
|
String value
@ServerEndpoint("/chat")
@ServerEndpoint("/chat/{user}")
@ServerEndpoint("/booking/{privilege-level}")
String[] subprotocols
Class<? extends Decoder>[] decoders
Class<? extends Encoder>[] encoders
Class<? extends ServerEndpointConfig.Configurator> configurator
Copyright © 2019 JBoss by Red Hat. All rights reserved.