Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-24 Thread Francesco Chicchiriccò
On 24 april 2016 10:14:18 CEST, "Francesco Chicchiriccò" wrote: >On 2016-04-22 22:16 Martin Grigorov wrote: >> Just to make it more clear: >> With the new improvement there won't be a need to add just one WSB to > >> the >> Page. >> You can add as many as you need, anywhere

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-24 Thread Francesco Chicchiriccò
On 2016-04-22 22:16 Martin Grigorov wrote: Just to make it more clear: With the new improvement there won't be a need to add just one WSB to the Page. You can add as many as you need, anywhere in the component tree. This sounds great. Can't you use directly Syncope as quickstart? git clone

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-22 Thread Martin Grigorov
Just to make it more clear: With the new improvement there won't be a need to add just one WSB to the Page. You can add as many as you need, anywhere in the component tree. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Apr 22, 2016 at 10:15 PM, Martin

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-22 Thread Martin Grigorov
Hi Francesco, I've just tried it and it works the way I wanted to change it: Now only the first behavior added to a component contributes the JS code that initializes the WS connection. Any other WSBehavior just adds itself to the component tree and later receives all messages (connect, message,

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-22 Thread Martin Grigorov
Hi, Thanks! I'll debug it this weekend! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Apr 22, 2016 at 9:38 AM, Francesco Chicchiriccò wrote: > On 21/04/2016 21:23, Martin Grigorov wrote: > >> Hi, >> >> Could you please try this

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-22 Thread Francesco Chicchiriccò
On 21/04/2016 21:23, Martin Grigorov wrote: Hi, Could you please try this code: public abstract class MyWebSocketBehavior extends WebSocketBehavior { private final static MetaDataKey IS_ALREADY_INSTALLED = new MetaDataKey() {}; @Override public void renderHead(Component

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-21 Thread Martin Grigorov
Hi, Could you please try this code: public abstract class MyWebSocketBehavior extends WebSocketBehavior { private final static MetaDataKey IS_ALREADY_INSTALLED = new MetaDataKey() {}; @Override public void renderHead(Component component, IHeaderResponse response) { Page

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-21 Thread Martin Grigorov
On Thu, Apr 21, 2016 at 8:41 AM, Francesco Chicchiriccò wrote: > On 20/04/2016 17:58, Martin Grigorov wrote: > >> Hi, >> >> There is no point in having more than one WebSocket connections per page. >> And actually, Wicket Native WebSockets do not support it out of the box.

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-21 Thread Francesco Chicchiriccò
On 20/04/2016 17:58, Martin Grigorov wrote: Hi, There is no point in having more than one WebSocket connections per page. And actually, Wicket Native WebSockets do not support it out of the box. The registry with the websocket connections at the server side uses a key

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-20 Thread Martin Grigorov
Hi, There is no point in having more than one WebSocket connections per page. And actually, Wicket Native WebSockets do not support it out of the box. The registry with the websocket connections at the server side uses a key so there could be just one

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-20 Thread Francesco Chicchiriccò
Hi Martin, thanks for your prompt reply. Are you suggesting that the best practice is to add WebSocketBehavior at most once per page - and possibly to the page itself? My current situation is that I have defined three different anonymous WebSocketBehavior instances, added to three different

Re: Adding multiple WebSocketBehavior instances to the same page

2016-04-19 Thread Martin Grigorov
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

Adding multiple WebSocketBehavior instances to the same page

2016-04-19 Thread Francesco Chicchiriccò
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