We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Hi 楼主,很高兴能在网上看到你的项目,让我能够自学的时候练习一把 现在刚刚把server部分实现完,client还没到
我在实现的时候发现BaseMsg这个类可以改进一下,我增加了一个方法
public abstract void dealWithServerMsg(ChannelHandlerContext ctx);
这样在ServerHandler端就可以用回调的方法来handle不同type的message,而且如果后期加入别的message,只用实现接口,而不用更改server的设置 if(msg.getClientId() == null) { AbstractMsg loginMsg = new LoginMsg(); ctx.channel().writeAndFlush(loginMsg); } else { // 回调机制,由message本身来完成操作 msg.dealWithMessage(ctx); }
可以互相交流一下哈
The text was updated successfully, but these errors were encountered:
good , 不错 ,数据 与 操作 分开 ,采用访问者模式也不错,采用回调的方式
Sorry, something went wrong.
No branches or pull requests
Hi 楼主,很高兴能在网上看到你的项目,让我能够自学的时候练习一把
现在刚刚把server部分实现完,client还没到
我在实现的时候发现BaseMsg这个类可以改进一下,我增加了一个方法
public abstract void dealWithServerMsg(ChannelHandlerContext ctx);
这样在ServerHandler端就可以用回调的方法来handle不同type的message,而且如果后期加入别的message,只用实现接口,而不用更改server的设置
if(msg.getClientId() == null) {
AbstractMsg loginMsg = new LoginMsg();
ctx.channel().writeAndFlush(loginMsg);
} else {
// 回调机制,由message本身来完成操作
msg.dealWithMessage(ctx);
}
可以互相交流一下哈
The text was updated successfully, but these errors were encountered: