|
@@ -65,7 +65,7 @@ public class WebSocketSessionManager {
|
|
|
|
|
|
private static void sendToAll(String content) {
|
|
private static void sendToAll(String content) {
|
|
SESSIONS.values().stream().filter(MagicConsoleSession::writeable).forEach(session -> sendBySession(session, content));
|
|
SESSIONS.values().stream().filter(MagicConsoleSession::writeable).forEach(session -> sendBySession(session, content));
|
|
- sendToMachine(null, content);
|
|
|
|
|
|
+ sendToMachineByClientId(null, content);
|
|
}
|
|
}
|
|
|
|
|
|
public static void sendLogs(String sessionId, String message) {
|
|
public static void sendLogs(String sessionId, String message) {
|
|
@@ -102,7 +102,7 @@ public class WebSocketSessionManager {
|
|
if (session != null && session.writeable()) {
|
|
if (session != null && session.writeable()) {
|
|
sendBySession(session, content);
|
|
sendBySession(session, content);
|
|
} else {
|
|
} else {
|
|
- sendToMachine(clientId, content);
|
|
|
|
|
|
+ sendToMachineByClientId(clientId, content);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -112,16 +112,23 @@ public class WebSocketSessionManager {
|
|
.filter(MagicConsoleSession::writeable)
|
|
.filter(MagicConsoleSession::writeable)
|
|
.filter(it -> !it.getClientId().equals(excludeClientId))
|
|
.filter(it -> !it.getClientId().equals(excludeClientId))
|
|
.forEach(session -> sendBySession(session, content));
|
|
.forEach(session -> sendBySession(session, content));
|
|
- sendToMachine(null, content);
|
|
|
|
|
|
+ sendToMachineByClientId(null, content);
|
|
}
|
|
}
|
|
|
|
|
|
- private static void sendToMachine(String clientId, String content) {
|
|
|
|
|
|
+ public static void sendToMachineByClientId(String clientId, String content) {
|
|
if (magicNotifyService != null) {
|
|
if (magicNotifyService != null) {
|
|
// 通知其他机器去发送消息
|
|
// 通知其他机器去发送消息
|
|
magicNotifyService.sendNotify(new MagicNotify(instanceId, EventAction.WS_S_C, clientId, content));
|
|
magicNotifyService.sendNotify(new MagicNotify(instanceId, EventAction.WS_S_C, clientId, content));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static void sendToMachine(MessageType messageType, Object ... args) {
|
|
|
|
+ if (magicNotifyService != null) {
|
|
|
|
+ // 通知其他机器去发送消息
|
|
|
|
+ magicNotifyService.sendNotify(new MagicNotify(instanceId, EventAction.WS_S_S, null, buildMessage(messageType, args)));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public static String buildMessage(MessageType messageType, Object... values) {
|
|
public static String buildMessage(MessageType messageType, Object... values) {
|
|
StringBuilder builder = new StringBuilder(messageType.name().toLowerCase());
|
|
StringBuilder builder = new StringBuilder(messageType.name().toLowerCase());
|
|
if (values != null) {
|
|
if (values != null) {
|