diff options
author | Vitaly Takmazov | 2018-02-15 11:28:35 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-02-15 11:28:35 +0300 |
commit | b28fe90514ef57706ab1219e7eda517bf3198f26 (patch) | |
tree | 0756cc695b2c68361094b946428ddb38c7892836 /juick-server/src/main/java/com/juick/server/WebsocketManager.java | |
parent | 3f2846a1e151793a6908620c094984894e899a3b (diff) |
server: skip empty ws messages
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/WebsocketManager.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/WebsocketManager.java | 4 |
1 files changed, 4 insertions, 0 deletions
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 475fd8b6..a260817d 100644 --- a/juick-server/src/main/java/com/juick/server/WebsocketManager.java +++ b/juick-server/src/main/java/com/juick/server/WebsocketManager.java @@ -27,6 +27,7 @@ import com.juick.server.util.HttpNotFoundException; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; import com.juick.service.UserService; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -139,6 +140,9 @@ public class WebsocketManager extends TextWebSocketHandler { @Override protected void handleTextMessage(WebSocketSession session, TextMessage message) { + if (StringUtils.defaultString(message.getPayload()).trim().isEmpty()) { + return; + } clients.stream().filter(c -> c.session.equals(session)).findFirst().ifPresent( c -> { if (c.visitor.getName().equals(serviceUser)) { try { |