From becc5e008199c94ffce1435839d85999b57f131b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 28 May 2018 00:24:09 +0300 Subject: ws fixes --- juick-server/src/main/java/com/juick/server/WebsocketManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'juick-server/src/main/java/com/juick') diff --git a/juick-server/src/main/java/com/juick/server/WebsocketManager.java b/juick-server/src/main/java/com/juick/server/WebsocketManager.java index 5c976416..1d09ad77 100644 --- a/juick-server/src/main/java/com/juick/server/WebsocketManager.java +++ b/juick-server/src/main/java/com/juick/server/WebsocketManager.java @@ -133,7 +133,7 @@ public class WebsocketManager extends TextWebSocketHandler { public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { synchronized (clients) { logger.debug("session closed with status {}: {}", status.getCode(), status.getReason()); - clients.removeIf(c -> c.session.getId().equals(session.getId())); + clients.removeIf(c -> c.session.getDelegate().getId().equals(session.getId())); logger.debug("{} clients connected", clients.size()); } @@ -154,7 +154,7 @@ public class WebsocketManager extends TextWebSocketHandler { @Override protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { - User user = clients.stream().filter(c -> c.session.equals(session)).map(c -> c.visitor) + User user = clients.stream().filter(c -> c.session.getDelegate().equals(session)).map(c -> c.visitor) .findFirst().orElse(AnonymousUser.INSTANCE); if (!user.isAnonymous()) { String command = message.getPayload().trim(); -- cgit v1.2.3