public class AsityServerEndpoint extends Endpoint
Endpoint and Session into ServerWebSocket.
ServerEndpointConfig config = ServerEndpointConfig.Builder.create(AsityServerEndpoint.class,
"/cettia")
.configurator(new Configurator() {
@Override
protected <T> T getEndpointInstance(Class<T> endpointClass) {
return endpointClass.cast(new AsityServerEndpoint().onwebsocket(ws -> {}));
}
@Override
public void modifyHandshake(ServerEndpointConfig config, HandshakeRequest request, HandshakeResponse response) {
config.getUserProperties().put(HandshakeRequest.class.getName(), request);
}
})
.build();
| Constructor and Description |
|---|
AsityServerEndpoint() |
| Modifier and Type | Method and Description |
|---|---|
void |
onClose(Session session,
CloseReason closeReason) |
void |
onError(Session session,
Throwable throwable) |
void |
onOpen(Session session,
EndpointConfig config) |
AsityServerEndpoint |
onwebsocket(Action<ServerWebSocket> action)
Registers an action to be called when
ServerWebSocket is
available. |
public void onOpen(Session session, EndpointConfig config)
public void onClose(Session session, CloseReason closeReason)
public AsityServerEndpoint onwebsocket(Action<ServerWebSocket> action)
ServerWebSocket is
available.Copyright © 2015–2019. All rights reserved.