update 电单车协议

This commit is contained in:
Guoqs
2024-07-15 13:49:40 +08:00
parent 6f395dfda8
commit 94c820cbf5
4 changed files with 274 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package com.jsowell.netty.server;
import com.jsowell.common.constant.Constants;
import com.jsowell.netty.server.electricbicycles.ElectricBicyclesServerChannelInitializer;
import com.jsowell.netty.server.mqtt.BootNettyMqttChannelInboundHandler;
import com.jsowell.netty.server.yunkuaichong.NettyServerChannelInitializer;
import io.netty.bootstrap.ServerBootstrap;
@@ -28,6 +29,9 @@ public class NettyServerManager implements CommandLineRunner {
@Resource
private NettyServerChannelInitializer nettyServerChannelInitializer;
@Resource
private ElectricBicyclesServerChannelInitializer electricBicyclesServerChannelInitializer;
@Override
public void run(String... args) throws Exception {
startNettyServer(Constants.SOCKET_IP, 9011);
@@ -82,7 +86,7 @@ public class NettyServerManager implements CommandLineRunner {
.option(ChannelOption.SO_REUSEADDR, true)
.childOption(ChannelOption.SO_KEEPALIVE, true)
.childOption(ChannelOption.SO_REUSEADDR, true)
.childHandler(nettyServerChannelInitializer)
.childHandler(electricBicyclesServerChannelInitializer)
.localAddress(new InetSocketAddress(host, port));
ChannelFuture future = bootstrap.bind(port).sync();