diff --git a/flow-client/src/main/java/com/vaadin/client/communication/MessageSender.java b/flow-client/src/main/java/com/vaadin/client/communication/MessageSender.java index 8dc9eb0463c..97c4ab2f4e9 100644 --- a/flow-client/src/main/java/com/vaadin/client/communication/MessageSender.java +++ b/flow-client/src/main/java/com/vaadin/client/communication/MessageSender.java @@ -210,11 +210,13 @@ private JsonObject preparePayload(final JsonArray reqInvocations, * The contents of the request to send */ public void send(final JsonObject payload) { - if (!messageQueue.isEmpty()) { + if (!isPushCommunication()) { + if (!messageQueue.isEmpty()) { + messageQueue.add(payload); + return; + } messageQueue.add(payload); - return; } - messageQueue.add(payload); sendPayload(payload); } @@ -237,7 +239,7 @@ private void sendPayload(final JsonObject payload) { registry.getRequestResponseTracker().startRequest(); } - if (push != null && push.isBidirectional()) { + if (isPushCommunication()) { // When using bidirectional transport, the payload is not resent // to the server during reconnection attempts. // Keep a copy of the message, so that it could be resent to the @@ -271,6 +273,10 @@ public void run() { } } + private boolean isPushCommunication() { + return push != null && push.isBidirectional(); + } + private void resetTimer() { if (resendMessageTimer != null) { resendMessageTimer.cancel();