JAVA通过netty实现接收多UDP上报数据再WebSocket推送至前端
Gradle引入依赖
1 | // netty |
在config包下新建WebSocketConfig
1 | import org.springframework.context.annotation.Configuration; |
新建netty包
在controller同级目录新建包netty及其子包
1 | netty/channel |
/netty/channel/UdpServerConfig
1 | import lombok.Data; |
/netty/channel/UdpServer
1 | import com.network.analysis.system.netty.channel.UdpServerChannelInboundHandler; |
/netty/channel/UdpServerChannelInboundHandler
1 | import com.network.analysis.system.netty.config.UdpServerConfig; |