diff options
author | Vitaly Takmazov | 2016-06-28 16:08:16 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-06-28 16:08:16 +0300 |
commit | 0f907b3973e851970882a00da123f6b7a6a359fb (patch) | |
tree | a0924757652f110524c51284d5e22a32dd062ac0 | |
parent | c4948c141a68433b4ba9eca167622816dcd10fa1 (diff) |
send messages to legacy urls
-rw-r--r-- | src/main/java/com/juick/ws/XMPPConnection.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/juick/ws/XMPPConnection.java b/src/main/java/com/juick/ws/XMPPConnection.java index 8194862c..a6f4e2cb 100644 --- a/src/main/java/com/juick/ws/XMPPConnection.java +++ b/src/main/java/com/juick/ws/XMPPConnection.java @@ -120,6 +120,14 @@ public class XMPPConnection implements Runnable, Stream.StreamListener, Message. logger.log(Level.WARNING, "ws error", e); } }); + ws.clients.stream().filter(c -> c.legacy && c.allMessages).forEach(c -> { + try { + logger.info("sending message to legacy client " + c.visitor.getUID()); + c.session.sendMessage(new TextMessage(json)); + } catch (IOException e) { + logger.log(Level.WARNING, "ws error", e); + } + }); } } @@ -138,6 +146,14 @@ public class XMPPConnection implements Runnable, Stream.StreamListener, Message. logger.log(Level.WARNING, "ws error", e); } }); + ws.clients.stream().filter(c -> (c.legacy && c.allReplies) || (c.legacy && c.MID == jmsg.getMID())).forEach(c -> { + try { + logger.info("sending reply to legacy client " + c.visitor.getUID()); + c.session.sendMessage(new TextMessage(json)); + } catch (IOException e) { + logger.log(Level.WARNING, "ws error", e); + } + }); } } } |