rave-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Fischer <c.fisc...@cs-hertwig.de>
Subject Re: make shure OpenAjax Hub is ready before Userscripts are executed (wookie)
Date Mon, 03 Sep 2012 15:30:36 GMT
Am 02.09.2012 18:54, schrieb Scott Wilson:
> On 2 Sep 2012, at 17:08, Christian Fischer wrote:
>
>> Am 01.09.2012 11:54, schrieb Scott Wilson:
>>> On 1 Sep 2012, at 09:20, Christian Fischer wrote:
>>>
>>>> Hi all,
>>>>
>>>> Does anyone know how to make shure that the OpenAjax "hub" Instance of a
wookie-iframe-widget is ready and already connected before any user defined scripts are executed
inside the widget?
>>>>
>>>> _Sometimes_ it throws the following ErrorMessage then i'm subsribing to channels
by loading the widget.
>>>>
>>>> Uncaught Error: OpenAjax.hub.Error.Disconnected
>>>>
>>>> For OpenSocial Widgets it's not a problem - these widgets are waiting until
the hub is ready, but wookie not?
>>> Yes thats right - I don't know what mechanism is used in Shindig for this but
it would make sense to replicate it in Wookie.
>>>
>>> The relevant part of the Wookie feature is this:
>>>
>>> http://svn.apache.org/viewvc/incubator/wookie/trunk/features/openajax/
>> OK, is there a howto to get the wookie sources into the rave maven project?
>> I'm not familiar with maven.
>> What must i do to get the wookie sources into my project to use the Custom Build
instead of the wookie-war wich comes with the rave-project?
> OK, so first you need to change the Wookie version you build Rave with; to do this, in
rave-project/pom.xml change:
>
>          <apache.wookie.version>0.10.0-incubating</apache.wookie.version>
>
> to:
>
>          <apache.wookie.version>0.13.0-incubating-SNAPSHOT</apache.wookie.version>
>
> Next, you need to publish your custom Wookie build locally. You can do this from the
root of your Wookie source folder using:
>
> ant publish-local
>
> This will create a 0.13.0-incubating-SNAPSHOT war in your local Maven repository (e.g.
in ~/.m2/repository/org/apache/wookie)
>
> Note however I've seen a bug in Ivy/Ant where this is cached rather than updated when
you make changes, so you may need to delete it  then re-publish whenever you make changes
(which is a pain)
>
> If you just want to try out some JavaScript changes interactively, you can run Rave,
then go into rave-portal/target/tomcat6x/webapps/wookie/features and edit OpenAjaxClient.js.
You can then see the effects just by reloading to clear the browser cached version. When you're
happy you've got a good working solution, you can copy it into your source folder then follow
the steps above to try it as part of a new build.
>
> Hope this helps,
>
> -S
Hi Scott,

thanks for the instructions - it worked.
For the wookie widgets there are only OpenAjax Iframe Container for 
displaying the widgets whereas Shindig loads some other components.
I have cusomized the   wookie/features/openajax/feature.xml and 
commented out the OpenAjaxClient.js
Then, connect manually inside the widgets taking care of the callback 
function from the openajaxhub.
Then the connection is ready, it calls automatically my defined function 
which subsribes to the needed topics.

	this.connect = function(){
		if(typeof window.hub === 'undefined'){
			window.hub = new OpenAjax.hub.IframeHubClient({
			    HubClient: {
			      onSecurityAlert: function(){
			    	  console.log("OpenAjax Security Error!");
			    	  }
			    }
			});	
			
			// Connect to the ManagedHub with callback function for asynchronous communication
			window.hub.connect(conn.callbackOnConnect);
		}
		else console.log("OAHub: Hub already defined.");
	}
	
	this.callbackOnConnect = function(hub, success, error){
		if(success){
			console.log("OAHub: Connection successfully established. ");
			ConnectionCallBackFunction(); // myfunction
		}
		else console.log("OAHub: Connection failed.");
	}


For general usage, i think we must use the callback function to wait 
until the hub is connected and after that load the content for the window.
Has someone an idea how to implement this properly, clean and nice into 
rave :)  (rave_wookie.js)?

>>>> Thanks,
>>>> Christian


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message