wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: Adding multiple WebSocketBehavior instances to the same page
Date Tue, 19 Apr 2016 16:07:09 GMT
Hi,

You could use something like:

if (getBehaviors(WebSocketBehavior.class).isEmpty()) {
  add(new WebSocketBehavior() {...});
}

This way only one instance will be added to one page instance.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Apr 19, 2016 at 5:50 PM, Francesco Chicchiriccò <ilgrosso@apache.org
> wrote:

> Hi all,
> in the upcoming Syncope 2.0 we are enjoying WebSocketBehavior for making
> our admin console UI more reactive.
>
> It mostly works - thanks for this! - but we are experiencing some troubles
> lately.
>
> There is a class BasePage which is extended by all other pages, and
> contains a panel which adds WebSocketBehavior.
> One of such pages (Dashboard) also contains two panels, each of which adds
> in turn WebSocketBehavior.
>
> I observe that when the first WebSocketBehavior (in BasePage) is added,
> the other two WebSocketBehavior instances' onConnect() method is not
> invoked at all.
>
> If instead, I do something like as following, in BasePage:
>
> if (!(pageRef.getPage() instanceof Dashboard)) {
>   add(new WebSocketBehavior() {...});
> }
>
> everything works as expected (naturally BasePages's WebSocketBehavior does
> not come into play): both on Dashboard and other pages.
>
> Any hint?
> TIA
>
> Regards.
>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> Involved at The Apache Software Foundation:
> member, Syncope PMC chair, Cocoon PMC, Olingo PMC, CXF committer
> http://home.apache.org/~ilgrosso/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message