From b28fe90514ef57706ab1219e7eda517bf3198f26 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 15 Feb 2018 11:28:35 +0300 Subject: server: skip empty ws messages --- juick-server/src/main/java/com/juick/server/WebsocketManager.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'juick-server/src/main') 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 475fd8b64..a260817d1 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 { -- cgit v1.2.3