aboutsummaryrefslogtreecommitdiff
path: root/juick-server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-15 11:28:35 +0300
committerGravatar Vitaly Takmazov2018-02-15 11:28:35 +0300
commitb28fe90514ef57706ab1219e7eda517bf3198f26 (patch)
tree0756cc695b2c68361094b946428ddb38c7892836 /juick-server
parent3f2846a1e151793a6908620c094984894e899a3b (diff)
server: skip empty ws messages
Diffstat (limited to 'juick-server')
-rw-r--r--juick-server/src/main/java/com/juick/server/WebsocketManager.java4
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 {