Joburgess 4 роки тому
батько
коміт
a387ff2eff

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SoundController.java

@@ -58,7 +58,7 @@ public class SoundController extends BaseController {
 
     @RequestMapping("sendToUser")
     public HttpResponseResult sendToUser(String phone, String message) throws IOException {
-        WebSocketHandler.clients.get(phone).sendMessage(new TextMessage(message));
+        WebSocketHandler.WS_CLIENTS.get(phone).sendMessage(new TextMessage(message));
         return succeed();
     }
 

+ 2 - 2
mec-teacher/src/main/java/com/ym/mec/teacher/handler/WebSocketHandler.java

@@ -18,7 +18,7 @@ public class WebSocketHandler extends AbstractWebSocketHandler {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketHandler.class);
 
-    public static final Map<String, WebSocketSession> clients = new ConcurrentHashMap<>();
+    public static final Map<String, WebSocketSession> WS_CLIENTS = new ConcurrentHashMap<>();
 
     public WebSocketHandler() {
         super();
@@ -28,7 +28,7 @@ public class WebSocketHandler extends AbstractWebSocketHandler {
     public void afterConnectionEstablished(WebSocketSession session) throws Exception {
         String phone = session.getPrincipal().getName().split(":")[1];
         LOGGER.info("{}上线", session.getPrincipal().getName().split(":")[1]);
-        clients.put(phone, session);
+        WS_CLIENTS.put(phone, session);
         super.afterConnectionEstablished(session);
     }