public class AsityServerEndpoint
extends javax.websocket.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(javax.websocket.Session session,
javax.websocket.CloseReason closeReason) |
void |
onError(javax.websocket.Session session,
Throwable throwable) |
void |
onOpen(javax.websocket.Session session,
javax.websocket.EndpointConfig config) |
AsityServerEndpoint |
onwebsocket(Action<ServerWebSocket> action)
Registers an action to be called when
ServerWebSocket is
available. |
public void onOpen(javax.websocket.Session session,
javax.websocket.EndpointConfig config)
onOpen in class javax.websocket.Endpointpublic void onError(javax.websocket.Session session,
Throwable throwable)
onError in class javax.websocket.Endpointpublic void onClose(javax.websocket.Session session,
javax.websocket.CloseReason closeReason)
onClose in class javax.websocket.Endpointpublic AsityServerEndpoint onwebsocket(Action<ServerWebSocket> action)
ServerWebSocket is
available.Copyright © 2015–2018. All rights reserved.