aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/ws/WebsocketComponent.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-06-28 14:53:37 +0300
committerGravatar Vitaly Takmazov2016-06-28 14:53:37 +0300
commitf53538d230440f16948a12a34ffe587edcd0f245 (patch)
tree8e32f76206d5c87be5872aba1bad410733c2b592 /src/main/java/com/juick/ws/WebsocketComponent.java
parent9f2503cf924d79f00cb0956d37daf10e7a163163 (diff)
fixes
Diffstat (limited to 'src/main/java/com/juick/ws/WebsocketComponent.java')
-rw-r--r--src/main/java/com/juick/ws/WebsocketComponent.java7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/com/juick/ws/WebsocketComponent.java b/src/main/java/com/juick/ws/WebsocketComponent.java
index 83e811a6..7399c298 100644
--- a/src/main/java/com/juick/ws/WebsocketComponent.java
+++ b/src/main/java/com/juick/ws/WebsocketComponent.java
@@ -97,19 +97,18 @@ public class WebsocketComponent extends TextWebSocketHandler {
}
}
if (sockSubscr != null) {
- synchronized (clients) {
- clients.add(sockSubscr);
- }
+ clients.add(sockSubscr);
}
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception {
synchronized (clients) {
- clients.stream().filter(c -> c.session.equals(session)).forEach(c -> {
+ clients.stream().filter(c -> c.session.getId().equals(session.getId())).forEach(c -> {
logger.info(String.format("session %s closed with status %s", c.clientName, status.getCode()));
clients.remove(c);
});
}
+
}
class SocketSubscribed {