Polling for server side updates

Hi there,

I’m currently trying to put together a simple IM client using ITMILL and I’m having trouble when it comes to the chat window receiving messages. I have a window which contains a panel (used to display the chat as a list of labels) and a text area for typing responses. When I type a message into the text area and hit send all is well, the button click event adds the message I’m sending as a new label on the panel and it is updated immediately however when I recieve a message in the back end I need away of the panel getting updated without having a client side event fired

What I’m really after is a way my panel can poll the server for new messages every few seconds, or better still a way that the panel can somehow bind to the back end data and be notified whenever it changes.

Any thoughts/help would be gratefully recieved.
Thanks

If I remember correctly, ProgressIndicator has been used to solve this kind of problem.
http://itmill.com/documentation/itmill-toolkit-5-reference-manual/components.progressindicator.html

Hide it with css, if you don’t want to show it to the user.

Hi,

Ville is absolutely right about it.
Please keep in mind that you have to hide it using css not with setEnabled(false) because an inactive progress indicator will not poll!
Another thread related to this issue: http://forum.itmill.com/posts/list/703.page

In your code:

indicator.setStyleName(“invisible”);

In your CSS:
.i-progressindicator-invisible {
display: none;
}

If you do this, you can talk to your server-side component and ask him to update the value of components included in your panel.

Cheers,
Houman.

Thanks so much guys that works a treat!

I guess just having a progress indicator anywhere means your whole model gets refreshed everytime it polls, great workaround