Hey,
I wanted to implement some functionality using server push but have some problems with it.
As soon as I set the @Push annotation (automatic or manual), my application is not working as expected anymore. It seems like it is waiting for responses which arrive very late or never. When I do some interaction like clicking a button, nothing happens until I do a refresh. Is this the normal behaviour, am I missing something?
So I ask myself the question, what happens when I activate the @Push annotation with a single-threaded UI? Should the application work as before? If not, what do I need to change in order to make the application work again, so that I have a working state before I implement the actual push logic.
Im using version 7.1-SNAPSHOT (but tried beta1 too) with Tomcat 7.
Yes, enabling push should not affect the visible behaviour of the program unless the UI is updated in a background thread. Could you post a simple test case (optimally a single UI subclass) exhibiting the problem?
I tried a smaller application based on the charts examples and the push mechanism seems to work.
However, with my real application I still don’t have a clue, why it is not working as soon as I activate push. The debug log says “Establishing push connection” but never prints “Push connection established using XX”. In the info tab of the debug window it says “Communication methd: Push (null)”. So I think the Push Connection is stuck in the CONNECT_PENDING state.
Side note: The
Push sampler demo is not working for me, when I set it to Automatic push (websockets) a session expired message is displayed. I tried Chrome and Firefox.
What’s the exact version of your Tomcat? Some 7.0.2x (and maybe .3x) versions support Websockets only partially and might cause strange issues. 7.0.40+ should work fine. Is there anything interesting in the server log?
If you check your browser’s dev tools network view, there should be a GET /…/PUSH request (with a Connection: upgrade header - that’s the Websocket handshake request. What’s happening to it? Is it stalling or does it get a response? What status code does the response have?