求解下websocket的消息通道

快乐风男� 2021-03-24 04:41:54
for (Map.Entry<String, Channel> channel : webSocketClientMaps.entrySet()) {
if (channel.getValue() == null || !channel.getValue().isOpen() || channel.getValue() == ctx.channel()) {
continue;
}
if (startsWith) {
CNNettyUtil.sendDataToTargetChannel(channel.getValue(),
CNNettyUtil.toJson(successSocketResult(jsonObject)));
}
}
}
CNNettyUtil.sendDataToTargetChannel(ctx.channel(),
CNNettyUtil.toJson(successSocketResult(1, success)));

为什么要加一个这个判断 channel.getValue() == ctx.channel() 导致一直跳过
...全文
26 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧