Hi,
On Wed, Jun 10, 2015 at 12:52 AM, mashleyttu <[email protected]> wrote: > Hi All, I asked an Atmosphere question a few days ago and have another one. > > We are adding Atmosphere support to our application, and have added a > ResourceRegistrationListener to the EventBus so we can track and push > messages to users who request certain files. These files are generated on > the fly, and we don't want the user to have to wait for them to be created. > > When the file has been created, we use the EventBus to push a success > message to the client who requested the file. The issue is the message has > a > window.location.href = '/path/to/file.pdf' which is causing the page to > Have you tried with a custom iframe? I.e. create a temporary iframe and set its src to '/path/to/file.pdf'. Or with window.open(url) These approaches will leave the current page loaded. > disconnect and the resourceUnregistered event to fire. This is causing > problems for future download request. > > After the push message, I'm trying to have the client reconnect to the > server. I'm currently doing something like this: > > public void reconnect(AjaxRequestTarget target, WebPage page) throws > JSONException{ > JSONObject options = bus.getParameters().toJSON(); > List<AtmosphereBehavior> lstAtmoBehaviors = > page.getBehaviors(AtmosphereBehavior.class); > if(CollectionUtils.isNotEmpty(lstAtmoBehaviors)){ > options.put("url", > page.urlFor(lstAtmoBehaviors.get(0), > IResourceListener.INTERFACE, new PageParameters()).toString()); > } > //wait a quarter of a second for the download to fire > before reconnecting > target.appendJavaScript("setTimeout(function(){jQuery('#" + > page.getMarkupId() + > "').wicketAtmosphere("+options.toString()+");},250);"); > } > > > This generates the same connection ajax call that the AtmosphereBehavior > renderHead method method generates. I've verified it calls the EventBus > resourceRegistered method. The uuid is unfortunately blank though. > > Manually hitting the browser refresh button re-registers the page with the > uuid. > > Is there a fancy Wicket Atmosphere method to say "reconnect"? Or how do I > get Wicket to generate a UUID? Or a setting that says "reconnect" > automatically? > > THanks > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Atmosphere-Reconnect-after-Disconnect-tp4671118.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
