diff options
author | Artur Signell <artur@vaadin.com> | 2013-11-29 18:18:04 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-12-02 09:24:57 +0000 |
commit | c171850a2c6fab38a81b2d0ab92d3433b2cf558c (patch) | |
tree | 95241869930db868deb17b8090c9c8a705dc51f8 /client/src | |
parent | ea46029ea154cc018525219f06095817339607e8 (diff) | |
download | vaadin-framework-c171850a2c6fab38a81b2d0ab92d3433b2cf558c.tar.gz vaadin-framework-c171850a2c6fab38a81b2d0ab92d3433b2cf558c.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/src')
-rw-r--r-- | client/src/com/vaadin/client/communication/AtmospherePushConnection.java | 12 |
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); }-*/; |