Re: Getting access to AjaxRequestTarget
Hi, You can't do this the way you described it because Ajax is initiated by the browser. I can propose you three options: 1) use Ajax polling Store the messages in some data structure in the page/panel and with the help of AbstractAjaxTimerBehavior render the collected messages 2) WebSocket Add WebSocketBehavior (wicket-native-websocket-javax module) and publish IWebSocketPushMessage when you receive one from Redis. This way it will be real time instead of batching 3) Use Server Side Events - it is similar to web sockets but unidirectional. You can use wicketstuff-html5 library. It has SSE support. I would recommend you 2) Cheers, Martin On Sat, Jun 8, 2019, 03:22 Roman Sery wrote: > Hi, I have a question about getting access to the AjaxRequestTarget outside > the context of an ajax request. > > What I'm trying to do is send some javascript from the server to the > browser from a different thread where RequestCycle.get() is not available. > From within a WebPage, Im using Redis pub/sub channels, to subscribe to a > channel on page load, and when there are publications to the channel, I > need to send some JS to the browser. > > psudeo code: > > WebPage() { > start listening to channel a123, callback Function = onMsgPublished > } > > onMsgPublished(){ > //do something like this > target.appendjavascript("alert('test')"); > } > > Any ideas or perhaps some other way to accomplish this? > I'm using wicket 8.4. Thanks for any help! >
[ANNOUNCE] WicketStuff 9.0.0-M2 Released
WicketStuff core 9.0.0-M2 based on Apache Wicket 9.0.0-M2 is released and soon will be available at Maven Central! The changelog is: Andrea Del Bene (5): Code updated for WICKET-6662 (Maven install runs succesfully). Introduced supplier for current Locale Fixed typo for field localeSupplier Changed parameter from supplier to localeSupplier Merge pull request #664 from bitstorm/introduced-locale-supplier Martin Tzvetanov Grigorov (1): Update scala-maven-plugin to 4.0.2 Maxim Solodovnik (8): Project is switched to the next development version Typo in exception text is fixed Fixes #661: select2 is updated to 4.0.7 Jackson version is updated YUI tests should be fixed Code clean-up Dependencies are updated to most recent versions Wicketstuff 9.0.0-M2 is released Sven Meier (2): WICKET-6563 use a single session page manager WICKET-6563 use two session page stores for GAE The WicketStuff team - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
[ANNOUNCE] WicketStuff 8.5.0 Released
WicketStuff core 8.5.0 based on Apache Wicket 8.5.0 is released and soon will be available at Maven Central! The changelog since 8.4.0 is: Andrea Del Bene (1): Merge pull request #662 from andruhon/fix-641-and-improve-customization Andrew Kondratev (1): Fixes #641: prevent rest resource from creating a new session every time Martin Tzvetanov Grigorov (1): Call "MonitorFactory.getFactory().reset()" in @After callback Maxim Solodovnik (6): Switching to the next development version Fixes #661: select2 is updated to 4.0.7 Jackson version is updated Code clean-up Dependencies are updated to most recent versions Wicketstuff 8.5.0 is released The WicketStuff team - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Getting access to AjaxRequestTarget
Hi, I have a question about getting access to the AjaxRequestTarget outside the context of an ajax request. What I'm trying to do is send some javascript from the server to the browser from a different thread where RequestCycle.get() is not available. >From within a WebPage, Im using Redis pub/sub channels, to subscribe to a channel on page load, and when there are publications to the channel, I need to send some JS to the browser. psudeo code: WebPage() { start listening to channel a123, callback Function = onMsgPublished } onMsgPublished(){ //do something like this target.appendjavascript("alert('test')"); } Any ideas or perhaps some other way to accomplish this? I'm using wicket 8.4. Thanks for any help!