diff options
author | Artur Signell <artur@vaadin.com> | 2013-09-12 20:57:01 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-09-12 21:00:54 +0300 |
commit | 70649ac21a40a2b819856da39ebcfb5394ae3280 (patch) | |
tree | 89f10d39ba0884f6875ef2a00803a86f44d44ba8 | |
parent | 53282726c5769bf763beb5d8576c71e0e7b5bef3 (diff) | |
download | vaadin-framework-70649ac21a40a2b819856da39ebcfb5394ae3280.tar.gz vaadin-framework-70649ac21a40a2b819856da39ebcfb5394ae3280.zip |
Prepare for Atmosphere Javascript 2.0 (#12241)
Atmosphere 2.0 has changed enableProtocol to default to true.
Reopening a connection in Atmosphere 2.0 is signalled through an onReopen event (not present at all in Atmosphere 1.0.x)
Change-Id: I6013a83a0239b6ab7535631120e442ece2d4481d
-rw-r--r-- | client/src/com/vaadin/client/communication/AtmospherePushConnection.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java index 94ea0aaab2..93d5d879dc 100644 --- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java @@ -223,10 +223,26 @@ public class AtmospherePushConnection implements PushConnection { return config; } - protected void onOpen(AtmosphereResponse response) { - transport = response.getTransport(); + protected void onReopen(AtmosphereResponse response) { + VConsole.log("Push connection re-established using " + transport); + onConnect(response); + } + protected void onOpen(AtmosphereResponse response) { VConsole.log("Push connection established using " + transport); + onConnect(response); + } + + /** + * Called whenever a server push connection is established (or + * re-established). + * + * @param response + * + * @since 7.2 + */ + protected void onConnect(AtmosphereResponse response) { + transport = response.getTransport(); switch (state) { case CONNECT_PENDING: @@ -417,6 +433,7 @@ public class AtmospherePushConnection implements PushConnection { reconnectInterval: 5000, maxReconnectOnClose: 10000000, trackMessageLength: true, + enableProtocol: false, messageDelimiter: String.fromCharCode(@com.vaadin.shared.communication.PushConstants::MESSAGE_DELIMITER) }; }-*/; @@ -430,6 +447,9 @@ public class AtmospherePushConnection implements PushConnection { config.onOpen = $entry(function(response) { self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response); }); + config.onReopen = $entry(function(response) { + self.@com.vaadin.client.communication.AtmospherePushConnection::onReopen(*)(response); + }); config.onMessage = $entry(function(response) { self.@com.vaadin.client.communication.AtmospherePushConnection::onMessage(*)(response); }); |