summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/src/com/vaadin/shared/ApplicationConstants.java4
-rw-r--r--shared/src/com/vaadin/shared/communication/PushConstants.java46
2 files changed, 46 insertions, 4 deletions
diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java
index fc4abd1988..04cba79c0c 100644
--- a/shared/src/com/vaadin/shared/ApplicationConstants.java
+++ b/shared/src/com/vaadin/shared/ApplicationConstants.java
@@ -83,8 +83,4 @@ public class ApplicationConstants implements Serializable {
* Name of the parameter used to transmit the CSRF token.
*/
public static final String CSRF_TOKEN_PARAMETER = "v-csrfToken";
-
- public static final int WEBSOCKET_BUFFER_SIZE = 65536;
-
- public static final char WEBSOCKET_MESSAGE_DELIMITER = '|';
}
diff --git a/shared/src/com/vaadin/shared/communication/PushConstants.java b/shared/src/com/vaadin/shared/communication/PushConstants.java
new file mode 100644
index 0000000000..2d63621c12
--- /dev/null
+++ b/shared/src/com/vaadin/shared/communication/PushConstants.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.communication;
+
+import java.io.Serializable;
+
+/**
+ * Shared constants used by push.
+ *
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class PushConstants implements Serializable {
+
+ /**
+ * The size, in <b>bytes</b>, of the receiving buffer used by some servers.
+ */
+ public static final int WEBSOCKET_BUFFER_SIZE = 65536;
+
+ /**
+ * The maximum size, in <b>characters</b>, of a websocket message fragment.
+ * This is a conservative maximum chosen so that the size in bytes will not
+ * exceed {@link PushConstants#WEBSOCKET_BUFFER_SIZE} given a UTF-8 encoded
+ * message.
+ */
+ public static final int WEBSOCKET_FRAGMENT_SIZE = WEBSOCKET_BUFFER_SIZE / 4 - 1;
+
+ /**
+ * The character used to mark message boundaries when messages may be split
+ * into multiple fragments.
+ */
+ public static final char MESSAGE_DELIMITER = '\0';
+}