Search in sources :

Example 1 with WebSocketServer

use of com.code.server.gate.bootstarp.WebSocketServer in project summer by foxsugar.

the class GateApplication method main.

public static void main(String[] args) throws RegisterFailedException {
    SpringApplication.run(GateApplication.class, args);
    SpringUtil.getBean(ServerConfig.class);
    ServerConfig serverConfig = SpringUtil.getBean(ServerConfig.class);
    ThreadPool.getInstance().executor.execute(new SocketServer());
    if (serverConfig.getStartWebSocket() == 1) {
        ThreadPool.getInstance().executor.execute(new WebSocketServer());
    }
    ServerState.isWork = true;
    // 配置文件
    // 注册服务
    RedisManager.getGateRedisService().register(serverConfig.getServerType(), serverConfig.getServerId(), serverConfig.getHost(), serverConfig.getDomain(), serverConfig.getNetPort());
    // 心跳
    // 定时器
    ThreadPool.execute(() -> GameTimer.getInstance().fire());
    GameTimer.addTimerNode(IConstant.SECOND_5, true, () -> RedisManager.getGateRedisService().heart(serverConfig.getServerId()));
// //kafka消费者
// MsgConsumer.startAConsumer(IKafaTopic.GATE_TOPIC,serverConfig.getServerId(), new GateConsumer());
}
Also used : ServerConfig(com.code.server.gate.config.ServerConfig) WebSocketServer(com.code.server.gate.bootstarp.WebSocketServer) WebSocketServer(com.code.server.gate.bootstarp.WebSocketServer) SocketServer(com.code.server.gate.bootstarp.SocketServer)

Aggregations

SocketServer (com.code.server.gate.bootstarp.SocketServer)1 WebSocketServer (com.code.server.gate.bootstarp.WebSocketServer)1 ServerConfig (com.code.server.gate.config.ServerConfig)1