I am trying to get 2 distinct vaadin sessions of the same UI to update automatically using the broadcast mechanism described here https://vaadin.com/book/-/page/advanced.push.html.
(in other words I have the app running in Firefox and Safari at the same time)
I am building the program using the Eclipse plugin for vaadin and use vaadin 7.3.3
The application deploys on Tomcat 8.0.14 and has a button which, when pressed, sends a message to a TextArea using the broadcast mechanism.
In the logs I can see 2 broadcast listeners triggering which is fine but unfortunately only 1 UI gets updated.
I thought that the push feature would have allowed both UI to update automatically.
Am I misinterprating what we can do with push?
I will share the code if indeed we should expect the 2 UIs to automatically update.
I’m developing a realtime web app and testet the vaadin push feature extensively. Of course, multiple UIs should update. While I can only guess now what the problem is, here are some advices:
make sure you enabled push in UI class / in web.xml
each listener should be registered in a seperate UI (check hash of the attached UI)
check in which UI each TextArea is attached
TextArea setImmidiate is true
I also noticed that the example in the book only worked for me, if you explicitly register the UI object as broadcast listener, not the view / layout component. I dispatch all events to view /components via guava event bus:
@Override
public void receiveAppBroadcast(final BaseEvent event)
{
access(new Runnable()
{
@Override
public void run()
{
uiEventBus.post(event);
}
});
}
I hadn’t textArea.setImmediate(true) in my code and when I did put it in, I was able to see all the change propagate to the various web browsers.
Works like a charm now.