Transport mode doesn't change even after Push connection re-established

Hello all,

I have my UI decorated with the
@Push(transport = Transport.WEBSOCKET)
annotation, to indicate to the UI to use Websocket.

I confirm it is using Websocket by looking at the Vaadin Browser Debug window and seeing the following output:

153ms Establishing push connection
212ms Push connection established using websocket 

I was reading the Javadoc of PushConfiguration.[i]
setTransport
/i which mentions that "
Note that the new transport type will not be used until the push channel is disconnected and reconnected if already active
."

So, I have the following code running based on a Button click:

getPushConfiguration().setTransport( Transport.STREAMING );
getPushConnection().disconnect();

I call
disconnect()
on the Push connection to force it to re-connect, and I see this re-connect action happening in my Vaadin Browser Debug Window:

158368ms Push connection closed
158369ms Reopening push connection
163379ms Push connection re-established using websocket

Based on the Javadoc for
setTransport
, I would have expected the Push connection to be re-established with
streaming
Transport rather than
websocket
.

Is this a bug, or am I missing something here?

Looks like you are setting the transport and then disconnecting the connection before the transport can be sent to the client. Why do you want to change transport in the middle of everything? Sounds like a very unusual requirement

Hello Artur,

I am working to allow the user to change their Transport mode dynamically, in case they experience problems with the default Transport mode.

I have found that changing the PushMode between AUTOMATIC and DISABLED dynamically does work as expected.

Based on your suggestion,
I moved the code for calling getPushConnection().disconnect() into a separate button, so one button changes the transport, the other disconnects the push connection.

I click the first button to change the Transport, then the second button to disconnect the push connection.

When the push connection is re-established, I still see it using the old connection mode in the Javascript log and Vaadin Debug Window.