洪城义警-正式版后台
zengh
2022-05-26 4c19ddd36bdfb43b5ef4e8df3c9a98cd4d356d6c
src/main/java/org/springblade/modules/webscoket/WebSocketHandler.java
@@ -104,9 +104,10 @@
            //登录链接
            String id = jsonObj.get("id").toString();
            NettyConfig.getUserChannelMap().put(id,ctx.channel());
            NettyConfig.getChannelGroup().add(ctx.channel());
            System.out.println(jsonObj.get("type"));
            System.out.println(jsonObj.get("id"));
            System.out.println("___________________"+jsonObj.get("type"));
            System.out.println(jsonObj.get("id")+ "____________________________用户连接成功");
            //将用户id作为自定义属性加入到channel 中,方便随时channel中获取用户id
            AttributeKey<String> key = AttributeKey.valueOf("userId");
@@ -114,11 +115,6 @@
            //把用户信息添加到通道里
            ChannelSupervise.addChannel(ctx.channel(),id);
         }
      }