Vaadin 24.4 integrates with React, unifies Flow and Hilla development, and more!

ICEPush wins the add-on compo for October

Teemu Pöntelin
On Nov 4, 2010 12:30:00 PM

The ICEPush add-on has won the add-on competition for October leaving HbnContainer and CustomField to the second and third places. Here's what the add-on author, Artur Signell, has to say about his successful add-on.

"One day in May there was a forum post about ICEfaces making a generic javascript push implementation available. They even offered a GWT binding so it couldn't be hard to integrate it into Vaadin, right? And it was not! Wrapping the javascript into a GWT component was a breeze (did not use the GWT implementation provided as it did not really fit in with what I was trying to do). After a few hours of hacking, mainly figuring out how to make it simple to include the push functionality in a Vaadin application, the ICEPush add-on was born.

So what's all this about server push? Really simple Vaadin applications does have any need for server push as it follows a event-request-update-response cycle. All changes are initiated by the user e.g. by clicking a button, which causes the browser to send an event to the server. The server performs updates to the application and sends a response to the browser, which accordingly updates the browser with whatever changes the server did. The need for push comes in when you want to break this cycle and initiate updates to the application without an event from the browser.

ICEPush provides server push capabilities to any Vaadin application through a Vaadin component (ICEPush) and a specialized version of the Vaadin application servlet. The component must be added to a layout so it is rendered in the browser and catch and send events. Once rendered in the browser it loads the ICEPush javascript from the server, injects it into the page and then relies on the javascript to register itself and open a communications channel to the servlet. This channel is used purely for server to client communications i.e. notifying the client of changes that took place outside the normal event-update-response cycle. The channel will remain open until the server sends an event or there is a network problem. After being closed, the channel will immediately be reopened. No actual state changes is sent through the server push channel, only a notification that changes have taken place in the server. The client then performs the standard event-request-update-response cycle (the event is just a dummy event to initiate the cycle) and ends up with information about the changes made on the server side.

On the server side the implementation supports thread blocking for older servlet containers and asynchronous request processing for servlet containers supporting the Servlet 3.0 specification. More information about the underlying technology can be found at and the icefaces wiki.

Using ICEPush is very easy - all you need to take care of is that the component is inside a layout in your application and that you call the push() method whenever you want changes to be sent to the client. As always with Vaadin applications you should synchronize on the application instance when doing changes to it to avoid problems with simultaneous updates."

Congratulations to Artur! We still have two months left, so there are still two chances for you to win an iPad! See the add-on compo page for more details and a real-time top 20 scoreboard.

Teemu Pöntelin
Teemu Pöntelin has been working at Vaadin Ltd since 2008. He has been involved in various tasks ranging from large-scale Java EE application development to coming up with creative marketing ideas. You can follow him on Twitter – @teemupontelin
Other posts by Teemu Pöntelin