summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2013-05-20 15:08:48 +0300
committerVaadin Code Review <review@vaadin.com>2013-05-21 07:35:04 +0000
commit42c4b2097bc955ca18107c449e04f0d5d5683ca3 (patch)
tree2b441ac94efff0b0b4671d3b673d208efdf4b8b9 /client
parent2772641acf8f84046e3ac42c8386b65e4f2346f2 (diff)
downloadvaadin-framework-42c4b2097bc955ca18107c449e04f0d5d5683ca3.tar.gz
vaadin-framework-42c4b2097bc955ca18107c449e04f0d5d5683ca3.zip
Use "\0" instead of "|" as a push message delimiter (#11692)
Used with TrackMessageSizeInterceptor and with client-to-server Websocket message splitting (see #11648) The original issue that the delimiter can not appear in the message (unescaped) is apparently fixed in Atmosphere 1.0.13 Also ensure the max size of a websocket fragment in bytes does not exceed the buffer size (#11842) Change-Id: I768524bb54a5b8b9479dc7bda821256bd843dc52
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/communication/AtmospherePushConnection.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
index bc7e0b3fd2..ce3253ed50 100644
--- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
+++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
@@ -27,6 +27,7 @@ import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
import com.vaadin.client.ResourceLoader.ResourceLoadListener;
import com.vaadin.client.VConsole;
import com.vaadin.shared.ApplicationConstants;
+import com.vaadin.shared.communication.PushConstants;
import com.vaadin.shared.ui.ui.UIConstants;
/**
@@ -67,8 +68,7 @@ public class AtmospherePushConnection implements PushConnection {
*/
protected static class FragmentedMessage {
- // Jetty requires length less than buffer size
- private int FRAGMENT_LENGTH = ApplicationConstants.WEBSOCKET_BUFFER_SIZE - 1;
+ private static final int FRAGMENT_LENGTH = PushConstants.WEBSOCKET_FRAGMENT_SIZE;
private String message;
private int index = 0;
@@ -82,10 +82,12 @@ public class AtmospherePushConnection implements PushConnection {
}
public String getNextFragment() {
+ assert hasNextFragment();
+
String result;
if (index == 0) {
String header = "" + message.length()
- + ApplicationConstants.WEBSOCKET_MESSAGE_DELIMITER;
+ + PushConstants.MESSAGE_DELIMITER;
int fragmentLen = FRAGMENT_LENGTH - header.length();
result = header + getFragment(0, fragmentLen);
index += fragmentLen;
@@ -384,7 +386,8 @@ public class AtmospherePushConnection implements PushConnection {
contentType: 'application/json; charset=UTF-8',
reconnectInterval: '5000',
maxReconnectOnClose: 10000000,
- trackMessageLength: true
+ trackMessageLength: true,
+ messageDelimiter: String.fromCharCode(@com.vaadin.shared.communication.PushConstants::MESSAGE_DELIMITER)
};
}-*/;