shindig-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Baxter <rbaxte...@apache.org>
Subject Re: Noob Help
Date Wed, 12 Feb 2014 20:31:13 GMT
Hi Wade,

A couple of comments.

1.)  In your gadget you probably want to wrap gadgets.rpc.call in a
function passed to gadgets.util.registerOnLoadHandler to make sure the
gadget is completely initialized before making that rpc call.
2.)  In your container I would suggest you use the container feature.
It takes care of some of the nasty stuff with regards to registering
RPC callback functions.  All you then have to do is call
container.rpcRegister('initial_gadget_message', _messageHandler)

On Wed, Feb 12, 2014 at 2:16 PM, Wade Girard <Wade.Girard@calabrio.com> wrote:
> I am trying to implement a container running under Shindig.
>
> I am having difficulty getting the rpc (Gadget->Contianer) communication working.
>
> Here is my simple gadget:
>
> <Module>
>
>   <ModulePrefs title="Hello World">
>
>     <Require feature="rpc" />
>
>   </ModulePrefs>
>
>   <UserPref name="myName" display_name="Name" default_value="Wade" />
>
>   <Content type="html">
>
> <![CDATA[
>
> <script type="text/javascript">
>
> gadgets.rpc.call(null, 'initial_gadget_message', null, 'Hello there! Pre-onload message
sent successfully.');
>
> </script>
>
> <div id="widgetNode">Hello World</div>
>
> ]]>
>
>   </Content>
>
> </Module>
>
> Here is what I have done on the server (adapted)
>
> var id = "gadget_" + (this._static.id++);
>
> gadgets.rpc.register("initial_gadget_message", _messageHandler));
>
> var parent = window.location.origin; // also tried window.location.href
>
> iFrameNode.src = obj.iFrameUrls["default"] + "#parent=" parent + "&rpctoken=12345";
>
> iFrameNode.id = id;
>
> gadgets.rpc.setupReceiver(id);
>
> The container is at port 80, the gadget is at port 8080, on the same server (localhost)
> The gadget loads in the container, but most of the time produces this message, sometimes,
vary rarely, it will not produce the message.
>
> No relay set (used as window.postMessage targetOrigin), cannot send cross-domain message
>
> Any help is appreciated, thanks
> --
> Wade Girard | Principal Software Engineer
> Calabrio, Inc. | 400 1st Avenue N, Ste 300 | Minneapolis, MN 55401
> Phone: 763.795.7798

Mime
View raw message