public class VibeServerEndpoint
extends Endpoint
Session into ServerWebSocket. Once
Session is opened, JwaServerWebSocket is created and passed
to wsAction(). So what you need to do is to
configure this endpoint and to provide your action to receive
ServerWebSocket by overriding wsAction()
like the following usage.
ServerEndpointConfig config = ServerEndpointConfig.Builder.create(VibeServerEndpoint.class, "/vibe")
.configurator(new Configurator() {
@Override
protected <T> T getEndpointInstance(Class<T> endpointClass) throws InstantiationException {
return endpointClass.cast(new VibeServerEndpoint() {
@Override
public Action<ServerWebSocket> wsAction() {
return server.wsAction();
}
});
}
})
.build();
With CDI, the following usage is also available.
@ServerEndpoint("/vibe")
public class MyVibeServerEndpoint extends VibeServerEndpoint {
@Inject
private Server server;
@Override
protected Action<ServerWebSocket> wsAction() {
return server.wsAction();
}
}
| Constructor and Description |
|---|
VibeServerEndpoint() |
public void onOpen(Session session,
EndpointConfig config)
protectedwsAction()
Action to consume ServerWebSocket. By default, it
throws IllegalStateException so you should provide your action by
overriding it.public void onError(Session session,
Throwable throwable)
public void onClose(Session session,
CloseReason closeReason)
Copyright 2014, The Vibe Project