You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Dietze <di...@fh-wedel.de> on 2013/03/07 11:20:13 UTC

Timer-based update to various regions in a page - best approach?

My customer wants me to rewrite an existing application in a
way, that the various regions (drag-and-droppable panels) are
all updated every xy seconds (most of these panels contain
things like list views with search results, the user's mailbox
etc.).

Following a - what I would call - naive approach, one could
trigger updates via Ajax every xy seconds for each panel
individually. However I see the risk here of creating too many
simultaneous network connections.

Since I've never build anything like this before, I'd appreciate
some opinions / advice, how to approach this problem the "Wicket
way". 

Someone mentioned socket.io (which somewhat softens the client
side prerequisites of native WebSockets), but is there any
wrapper / adapter for Wicket yet? Also I feel a bit uneasy here,
as the application already exists, so that the refactoring
necessary to get the desired result might grow too high here?

Another idea that has crossed my mind was a "central Ajax
updater", that collects instances of all components needing an
update and then triggers a rerender for all of them at the same
time. I have not tried this, and I wonder if it is a good idea
at all (would it have a negative effect on user experience?).

I'd love to read your comments :)

M'bert

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
This parrot is no more.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Timer-based update to various regions in a page - best approach?

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Mar 7, 2013 at 1:51 PM, Martin Dietze <di...@fh-wedel.de> wrote:

> On Thu, March 07, 2013, Martin Grigorov wrote:
>
> > Or you can use one Ajax timer that broadcasts an event to all components
> in
> > the page and each component can decide whether to add itself to the
> target
> > or not.
>
> That looks pretty interesting. If I understand you correctly,
> they would all add themselves to the same target, so that there
> will be only one update for all components with display-relevant
> changes?
>
>
Yes.


> Cheers,
>
> M'bert
>
> --
> ----------- / http://herbert.the-little-red-haired-girl.org /
> -------------
> =+=
> Es gibt Themen genug in Deinem eigenen Leben, und wenn sie einmal ausgehn,
> gibt es Themenlaeden.  -- Die Sterne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Timer-based update to various regions in a page - best approach?

Posted by Martin Dietze <di...@fh-wedel.de>.
On Thu, March 07, 2013, Martin Grigorov wrote:

> Or you can use one Ajax timer that broadcasts an event to all components in
> the page and each component can decide whether to add itself to the target
> or not.

That looks pretty interesting. If I understand you correctly,
they would all add themselves to the same target, so that there
will be only one update for all components with display-relevant
changes? 

Cheers,

M'bert

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
Es gibt Themen genug in Deinem eigenen Leben, und wenn sie einmal ausgehn,
gibt es Themenlaeden.  -- Die Sterne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Timer-based update to various regions in a page - best approach?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can use wicket-atmosphere instead Socket.io.

Or you can use one Ajax timer that broadcasts an event to all components in
the page and each component can decide whether to add itself to the target
or not.


On Thu, Mar 7, 2013 at 12:20 PM, Martin Dietze <di...@fh-wedel.de> wrote:

> My customer wants me to rewrite an existing application in a
> way, that the various regions (drag-and-droppable panels) are
> all updated every xy seconds (most of these panels contain
> things like list views with search results, the user's mailbox
> etc.).
>
> Following a - what I would call - naive approach, one could
> trigger updates via Ajax every xy seconds for each panel
> individually. However I see the risk here of creating too many
> simultaneous network connections.
>
> Since I've never build anything like this before, I'd appreciate
> some opinions / advice, how to approach this problem the "Wicket
> way".
>
> Someone mentioned socket.io (which somewhat softens the client
> side prerequisites of native WebSockets), but is there any
> wrapper / adapter for Wicket yet? Also I feel a bit uneasy here,
> as the application already exists, so that the refactoring
> necessary to get the desired result might grow too high here?
>
> Another idea that has crossed my mind was a "central Ajax
> updater", that collects instances of all components needing an
> update and then triggers a rerender for all of them at the same
> time. I have not tried this, and I wonder if it is a good idea
> at all (would it have a negative effect on user experience?).
>
> I'd love to read your comments :)
>
> M'bert
>
> --
> ----------- / http://herbert.the-little-red-haired-girl.org /
> -------------
> =+=
> This parrot is no more.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Timer-based update to various regions in a page - best approach?

Posted by Martin Dietze <di...@fh-wedel.de>.
On Thu, March 07, 2013, Sven Meier wrote:

> Our customer can live with the limitations of this solution: As long as the 
> user doesn't do anything, he won't see any updated data.

Unfortunately, ours won't :/

Cheers,

M'bert

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
Its gone to meet its maker...  Its gone to join the choir invisible...
This Parrot is an Ex-Parrot!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Timer-based update to various regions in a page - best approach?

Posted by Sven Meier <sv...@meiers.net>.
Hi Martin,

we had a similar requirement here and decided against ajax polling, 
since this could add to the server load and prevent session expiration.

In Wicket 6 all components are notified of a running Ajax request 
(#onEvent() with an ART payload). Our special components keep a 
timestamp of their last rendering time and add themself to the ART 
automatically after a configurable duration.

Our customer can live with the limitations of this solution: As long as 
the user doesn't do anything, he won't see any updated data.

Hope this helps
Sven


On 03/07/2013 11:20 AM, Martin Dietze wrote:
> My customer wants me to rewrite an existing application in a
> way, that the various regions (drag-and-droppable panels) are
> all updated every xy seconds (most of these panels contain
> things like list views with search results, the user's mailbox
> etc.).
>
> Following a - what I would call - naive approach, one could
> trigger updates via Ajax every xy seconds for each panel
> individually. However I see the risk here of creating too many
> simultaneous network connections.
>
> Since I've never build anything like this before, I'd appreciate
> some opinions / advice, how to approach this problem the "Wicket
> way".
>
> Someone mentioned socket.io (which somewhat softens the client
> side prerequisites of native WebSockets), but is there any
> wrapper / adapter for Wicket yet? Also I feel a bit uneasy here,
> as the application already exists, so that the refactoring
> necessary to get the desired result might grow too high here?
>
> Another idea that has crossed my mind was a "central Ajax
> updater", that collects instances of all components needing an
> update and then triggers a rerender for all of them at the same
> time. I have not tried this, and I wonder if it is a good idea
> at all (would it have a negative effect on user experience?).
>
> I'd love to read your comments :)
>
> M'bert
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Timer-based update to various regions in a page - best approach?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Martin,

Disregarding the approach you follow to poll (or get pushed) changes I
would advice, if the volume  of changes is big, not to repaint the whole
components but to pass some "deltas" with changes (e.g. in JSON format) and
do the repainting at client: I have used previous approach before and the
difference in performance with respect to "normal" wicket updates was huge.



On Thu, Mar 7, 2013 at 11:20 AM, Martin Dietze <di...@fh-wedel.de> wrote:

> My customer wants me to rewrite an existing application in a
> way, that the various regions (drag-and-droppable panels) are
> all updated every xy seconds (most of these panels contain
> things like list views with search results, the user's mailbox
> etc.).
>
> Following a - what I would call - naive approach, one could
> trigger updates via Ajax every xy seconds for each panel
> individually. However I see the risk here of creating too many
> simultaneous network connections.
>
> Since I've never build anything like this before, I'd appreciate
> some opinions / advice, how to approach this problem the "Wicket
> way".
>
> Someone mentioned socket.io (which somewhat softens the client
> side prerequisites of native WebSockets), but is there any
> wrapper / adapter for Wicket yet? Also I feel a bit uneasy here,
> as the application already exists, so that the refactoring
> necessary to get the desired result might grow too high here?
>
> Another idea that has crossed my mind was a "central Ajax
> updater", that collects instances of all components needing an
> update and then triggers a rerender for all of them at the same
> time. I have not tried this, and I wonder if it is a good idea
> at all (would it have a negative effect on user experience?).
>
> I'd love to read your comments :)
>
> M'bert
>
> --
> ----------- / http://herbert.the-little-red-haired-girl.org /
> -------------
> =+=
> This parrot is no more.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>