use of com.tvd12.ezyfoxserver.client.setup.EzyAppSetup in project ezyfox-server-example by tvd12.
the class SimpleChatClient method setup.
protected EzyClient setup() {
EzyClientConfig clientConfig = EzyClientConfig.builder().zoneName(ZONE_NAME).build();
EzyClients clients = EzyClients.getInstance();
EzyClient client = new EzyUTClient(clientConfig);
clients.addClient(client);
EzySetup setup = client.setup();
setup.addEventHandler(EzyEventType.CONNECTION_SUCCESS, new EzyConnectionSuccessHandler());
setup.addEventHandler(EzyEventType.CONNECTION_FAILURE, new EzyConnectionFailureHandler());
setup.addDataHandler(EzyCommand.HANDSHAKE, new ExHandshakeEventHandler());
setup.addDataHandler(EzyCommand.LOGIN, new ExLoginSuccessHandler());
setup.addDataHandler(EzyCommand.APP_ACCESS, new ExAccessAppHandler());
EzyAppSetup appSetup = setup.setupApp(APP_NAME);
appSetup.addDataHandler("chat/sendMessage", new ChatSendMessageResponseHandler());
appSetup.addDataHandler("greet", new ChatGreetResponseHandler());
appSetup.addDataHandler("hello", new ChatHelloResponseHandler());
return client;
}
use of com.tvd12.ezyfoxserver.client.setup.EzyAppSetup in project ezyfox-server by youngmonkeys.
the class EzySimpleAppEntry method setAppRequestController.
private void setAppRequestController(EzyAppContext appContext, EzyBeanContext beanContext) {
EzyAppSetup setup = appContext.get(EzyAppSetup.class);
EzyAppRequestController controller = newUserRequestController(beanContext);
setup.setRequestController(controller);
Set<String> commands = ((EzyCommandsAware) controller).getCommands();
appContext.setProperty(COMMANDS, commands);
}
Aggregations