diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty8/StompSocket.java b/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty8/StompSocket.java index fb1c8d4ab0..39cf0dbd4f 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty8/StompSocket.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty8/StompSocket.java @@ -76,11 +76,11 @@ class StompSocket extends TransportSupport implements WebSocket.OnTextMessage, S try { if (data != null) { - if (data.startsWith("\n")) { + if (data.equals("\n")) { sendToActiveMQ(new KeepAliveInfo()); + } else { + protocolConverter.onStompCommand((StompFrame)wireFormat.unmarshal(new ByteSequence(data.getBytes("UTF-8")))); } - - protocolConverter.onStompCommand((StompFrame)wireFormat.unmarshal(new ByteSequence(data.getBytes("UTF-8")))); } } catch (Exception e) { onException(IOExceptionSupport.create(e)); diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty9/StompSocket.java b/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty9/StompSocket.java index 3b04677729..8969b560d0 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty9/StompSocket.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty9/StompSocket.java @@ -136,11 +136,11 @@ class StompSocket extends TransportSupport implements WebSocketListener, StompTr try { if (data != null) { - if (data.startsWith("\n")) { + if (data.equals("\n")) { sendToActiveMQ(new KeepAliveInfo()); + } else { + protocolConverter.onStompCommand((StompFrame)wireFormat.unmarshal(new ByteSequence(data.getBytes("UTF-8")))); } - - protocolConverter.onStompCommand((StompFrame)wireFormat.unmarshal(new ByteSequence(data.getBytes("UTF-8")))); } } catch (Exception e) { onException(IOExceptionSupport.create(e));