HttpRequestHandler--HTTP請求處理類
TextWebSocketFrameHandler--對應Text訊息的處理類
WebSocketServer--系統主類
WebSocketServerInitializer--服務主程式的初始化類
WebSocketServer類程式碼:
importio.netty.bootstrap.ServerBootstrap;
importio.netty.channel.ChannelFuture;
importio.netty.channel.ChannelOption;
importio.netty.channel.EventLoopGroup;
importio.netty.channel.nio.NioEventLoopGroup;
importio.netty.channel.socket.nio.NioServerSocketChannel;
publicfinalclassWebSocketServer{
privateintport=0;
publicWebSocketServer(intport){
this.port=port;
}
HttpRequestHandler--HTTP請求處理類
TextWebSocketFrameHandler--對應Text訊息的處理類
WebSocketServer--系統主類
WebSocketServerInitializer--服務主程式的初始化類
WebSocketServer類程式碼:
importio.netty.bootstrap.ServerBootstrap;
importio.netty.channel.ChannelFuture;
importio.netty.channel.ChannelOption;
importio.netty.channel.EventLoopGroup;
importio.netty.channel.nio.NioEventLoopGroup;
importio.netty.channel.socket.nio.NioServerSocketChannel;
publicfinalclassWebSocketServer{
privateintport=0;
publicWebSocketServer(intport){
this.port=port;
}