| | |
| | | //登录链接 |
| | | 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")+ "____________________________用户连接成功"); |
| | |
| | | if(window.WebSocket){ |
| | | socket = new WebSocket("ws://localhost:9034/websocket"); |
| | | socket.onmessage = function(event){ |
| | | debugger |
| | | var ta = document.getElementById('responseContent'); |
| | | ta.value += event.data + "\r\n"; |
| | | }; |
| | |
| | | String name = group.name(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("xqid", msg); |
| | | jsonObject.put("type", "taks"); |
| | | System.out.println("空间大小:" + group.size() + ",名字:" + name); |
| | | group.writeAndFlush(new TextWebSocketFrame(String.valueOf(jsonObject))); |
| | | } |