WebSocketBehavior has only callbacks. They have IPartialPageUpdateHandler as parameter (this is the base interface for AjaxRequestTarget and IWebSocketRequestHandler) which you can use to add components.
There are two use cases: 1) the browser sends a message WebSocketBehavior#onMessage(Text|Binary, IPartialPageUpdateHandler) is called and you can react on this message 2) the server pushes a message 2.1) simple case: broadcast plain text or byte[] WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get( application); webSocketSettings.getConnectionRegistry().getConnection(app[, sessionId, pageIdKey]).sendMessage( text | binary ); 2.2) more complex case: update Wicket components here you need to broadcast IWebSocketPushMessage - this is a specialization of IWebSocketMessage that is used when you need to push from the server to the client This code could be in any application service class: WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get( application); WebSocketPushBroadcaster broadcaster = new WebSocketPushBroadcaster( webSocketSettings.getConnectionRegistry()); 2.2.1) to all connections: broadcaster.broadcastAll(application, message); 2.2.2) to specific client ConnectedMessage wsMessage = new ConnectedMessage(application, sessionId, pageIdKey); broadcaster.broadcast(wsMessage, message); Broadcasting IWebSocketPushMessage will call WebSocketBehavior#onPush() where you can update any components We should add this to the guide! Martin On Aug 17, 2017 09:28, "nino martinez wael" <nino.martinez.w...@gmail.com> wrote: > But how do I then refresh the target from serverside? WebSocketBehavior > does not have an method that lets me get a target? > > On Thu, Aug 17, 2017 at 7:45 AM, Martin Grigorov < > martin.grigo...@gmail.com> > wrote: > > > Yes. > > The API is the same. > > > > On Aug 17, 2017 08:44, "nino martinez wael" < > nino.martinez.w...@gmail.com> > > wrote: > > > > > is there way to repaint an component like with ajax targets > > > (target.add(component))? > > > > > > On Wed, Aug 16, 2017 at 1:57 PM, nino martinez wael < > > > nino.martinez.w...@gmail.com> wrote: > > > > > > > I'snt there something more simple? > > > > > > > > On Wed, Aug 16, 2017 at 1:54 PM, Martin Grigorov < > mgrigo...@apache.org > > > > > > > wrote: > > > > > > > >> Use the examples as inspiration: > > > >> > > > >> http://examples8x.wicket.apache.org/websockets/ > > > >> https://github.com/apache/wicket/tree/master/wicket-examples > > > >> /src/main/java/org/apache/wicket/examples/websocket > > > >> > > > >> Martin Grigorov > > > >> Wicket Training and Consulting > > > >> https://twitter.com/mtgrigorov > > > >> > > > >> On Wed, Aug 16, 2017 at 2:52 PM, nino martinez wael < > > > >> nino.martinez.w...@gmail.com> wrote: > > > >> > > > >> > Hi > > > >> > > > > >> > I am looking into Wicket 8 and websockets using pax wicket, in my > > case > > > >> I am > > > >> > using jetty 9.3.14. I want to do a simple websocket sample.. > > > >> > > > > >> > However I cannot find something as simple as > > > >> > a AjaxSelfUpdatingTimerBehavior as an websocket behavior.. > > > >> > > > > >> > So whats the simplest way todo a websocket example that shows some > > > >> change > > > >> > at clientside? > > > >> > > > > >> > -- > > > >> > Best regards / Med venlig hilsen > > > >> > Nino Martinez > > > >> > > > > >> > > > > > > > > > > > > > > > > -- > > > > Best regards / Med venlig hilsen > > > > Nino Martinez > > > > > > > > > > > > > > > > -- > > > Best regards / Med venlig hilsen > > > Nino Martinez > > > > > > > > > -- > Best regards / Med venlig hilsen > Nino Martinez >