| | |
| | | package com.zy.acs.manager.manager.websocket; |
| | | |
| | | import com.zy.acs.framework.common.Cools; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | } |
| | | |
| | | public static void broadcast(String message) { |
| | | sessions.forEach((id, session) -> { |
| | | try { |
| | | session.getBasicRemote().sendText(message); |
| | | } catch (Exception e) { |
| | | log.error("Failed to send message to session: {}", id, e); |
| | | } |
| | | }); |
| | | if (null != message && !message.trim().equals("")) { |
| | | sessions.forEach((id, session) -> { |
| | | try { |
| | | session.getBasicRemote().sendText(message); |
| | | } catch (Exception e) { |
| | | log.error("Failed to send message to session: {}", id, e); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |