summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-11-29 18:18:04 +0200
committerArtur Signell <artur@vaadin.com>2013-12-02 18:58:04 +0200
commitf040eb3824c45f47afc6d13323e7daaa496bf514 (patch)
tree290681a040244851dcf97d2ea6a5e3ff7bcaf0e1 /client
parentb2bf7193d223fc576f8435cc45c145c97f6ce0bc (diff)
downloadvaadin-framework-f040eb3824c45f47afc6d13323e7daaa496bf514.tar.gz
vaadin-framework-f040eb3824c45f47afc6d13323e7daaa496bf514.zip
Disable client timeout so websockets are not disconnected when idle (#13015)
Updated sleep method to ensure that long sleeps can be performed without losing the connection to the browser Change-Id: I4f29d946e7a9a400e303e3a574876e1bc2d56773
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/communication/AtmospherePushConnection.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
index 320ba9ebe7..95584412cd 100644
--- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
+++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
@@ -348,6 +348,14 @@ public class AtmospherePushConnection implements PushConnection {
state = State.CONNECT_PENDING;
}
+ protected void onClientTimeout(AtmosphereResponse response) {
+ state = State.DISCONNECTED;
+ errorHandler
+ .onError(
+ "Client unexpectedly disconnected. Ensure client timeout is disabled.",
+ -1);
+ }
+
protected void onReconnect(JavaScriptObject request,
final AtmosphereResponse response) {
if (state == State.CONNECTED) {
@@ -442,6 +450,7 @@ public class AtmospherePushConnection implements PushConnection {
fallbackTransport: 'streaming',
contentType: 'application/json; charset=UTF-8',
reconnectInterval: 5000,
+ timeout: -1,
maxReconnectOnClose: 10000000,
trackMessageLength: true,
enableProtocol: false,
@@ -476,6 +485,9 @@ public class AtmospherePushConnection implements PushConnection {
config.onReconnect = $entry(function(request, response) {
self.@com.vaadin.client.communication.AtmospherePushConnection::onReconnect(*)(request, response);
});
+ config.onClientTimeout = $entry(function(request) {
+ self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request);
+ });
return $wnd.jQueryVaadin.atmosphere.subscribe(config);
}-*/;