| | |
| | | /** |
| | | * 服务器主动群推送消息 |
| | | */ |
| | | public static void sendAllMessage(String message) throws IOException { |
| | | public static void sendMessage2AllClient(String message) throws IOException { |
| | | ConcurrentHashMap.KeySetView<String, WebSocketServer> ids = webSocketMap.keySet(); |
| | | for (String id : ids) { |
| | | WebSocketServer webSocketServer = webSocketMap.get(id); |
| | |
| | | /** |
| | | * 服务器指定客户端推送消息 |
| | | */ |
| | | public static void sendOneMessage(String message, String id) throws IOException { |
| | | public static void sendMessage2OneClient(String message, String id) throws IOException { |
| | | if (message != null && message.length() != 0 && webSocketMap.containsKey(id)) { |
| | | webSocketMap.get(id).sendMessage(message); |
| | | } else { |