shindig-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wade Girard <Wade.Gir...@Calabrio.com>
Subject Re: Noob Help
Date Wed, 12 Feb 2014 20:50:48 GMT
Hi Ryan,
	Thank you for your suggestions. I changed the gadget to this
<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">
		function init() {
			gadgets.rpc.call(null, 'initial_gadget_message', null, 'Hello there!
Pre-onload message sent successfully.');
		}
		gadgets.util.registerOnLoadHandler(init);
	</script>
	<div id="widgetNode">Hello World</div>
	]]>
  </Content>
</Module>


And Removed the code that did the gadgets.rpc.register and
gadgets.rpc.setupReceiver and added the code to the container. Here is
what it looks like (added the full config, in case I am missing something
there)

var testConfig = {};
			testConfig[osapi.container.ServiceConfig.API_PATH] =
'http://localhost/rpc';
			testConfig[osapi.container.ContainerConfig.RENDER_DEBUG] = '1';
			testConfig[osapi.container.ContainerConfig.GET_CONTAINER_TOKEN] =
function(callback) {
				gadgets.log('Updating container security token.');
				callback('john.doe:john.doe:appid:cont:url:0:default', 10);
			};
this._container = new osapi.container.Container(testConfig);
			this._container.rpcRegister("initial_gadget_message",
_setTitleHandler));



Unfortunately I am still getting the same message in the firebug console
No relay set (used as window.postMessage targetOrigin), cannot send
cross-domain message


Thanks for all your help.
-- 
Wade Girard | Principal Software Engineer

Calabrio, Inc. | 400 1st Avenue N, Ste 300 | Minneapolis, MN 55401
Phone: 763.795.7798




On 2/12/14, 2:31 PM, "Ryan Baxter" <rbaxter85@apache.org> wrote:

>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