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
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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to