[ 
http://jira.amdatu.org/jira/browse/AMDATU-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10547#comment-10547
 ] 

Ivo Ladage - van Doorn commented on AMDATU-160:
-----------------------------------------------

The problem is that the OpenAjax hub is actually connected after the 
gadgets.util.registerOnLoadHandler is invoked. This is because the method 
gadgets.Hub.connect actually adds an RPC call to the queue.
In iframe.js:

OpenAjax.gadgets.rpc.call( "..", "openajax.pubsub", callback, "con" );

Now this RPC call is not executed before all gadgets have finished loading. So 
first gadgets.util.registerOnLoadHandler is invoked on the subscribe gadget, 
then RPC calls from the queue are handled. As a result, the OpenAjax hub is not 
yet connected during the registerOnLoadHandler of the subscribe gadget.
When I handle the subscribe in an RPC call instead. So using this function it 
works as expected:

gadgets.util.registerOnLoadHandler( function() {
  OpenAjax.gadgets.rpc.call( "..", "openajax.pubsub", subscribe, "" );
}

function subscribe() {
  subId = gadgets.Hub.subscribe("amdatu.test", callback);
}
        


> While loading a gadget, the pubsub2router (Shindig 2.0) is not initialized
> --------------------------------------------------------------------------
>
>                 Key: AMDATU-160
>                 URL: http://jira.amdatu.org/jira/browse/AMDATU-160
>             Project: Amdatu
>          Issue Type: Bug
>          Components: Amdatu OpenSocial
>    Affects Versions: 0.0.6
>            Reporter: Naftali van der Loon
>            Assignee: Ivo Ladage - van Doorn
>            Priority: Critical
>             Fix For: 0.1.0
>
>         Attachments: AMDATU-160.patch, pubsub2gadgets.zip
>
>
> While loading a gadget, the pubsub2router (Shindig 2.0) is not initialized, 
> therefore a gadget cannot subscribe to the pubsub2router.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to