You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Benoit Aubuchon <be...@gmail.com> on 2008/07/02 07:29:39 UTC

Invalid Auth token when using gadgets.rpc.call across windows

Hello,

I'm trying to add a new feature to my container (Partuza!) and I have some
difficulty making the communication work across windows.
When using a callback with in *gadgets.rpc.call(null, "myTest", callback,
param); *I'm getting  "Invalid auth token." error message.

Here's what I've done:

-New file in /shinding/features/*mytest/mytest.js*:
MyTest.testIt = function(callback, param) {
    gadgets.rpc.call(null, "myTest", callback, param);
};

-Registring a new service in Partuza/html/container.js using:
gadgets.rpc.register('myTest', this.myTest);

-New gadget that use this new feature and simply call
MyTest.testIt(testCallback, "test");

In /shinding/features/*mytest/mytest.js*, if I don't pass any callback,
everything works fine but if I pass the callback I get the error.

Is this supported or am I doing somethign wrong?

I'm developing on Windows and testing with Firefox 3.

Thanks

Ben


Here's a better overview of the code:
File:/partuza/html/js/container.js:
var Container = Class.create();
Container.prototype = {
    initialize: function() {
        gadgets.rpc.register('myTest', this.myTest);
    },
    myTest: function(data) {
        if ($(this.f) != undefined) {
            return "test " + data;
        } else {

            return false;
        }
    }
};
==EOF==

File: /shindig/features/mytest/mytest.js:
var MyTest = MyTest || {};
MyTest.testIt = function(callback, param) {
    gadgets.rpc.call(null, "myTest", callback, param);
};
==EOF==

File: MyTestGadget.xml
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
  <ModulePrefs title="MyTest">
    <Require feature="opensocial-0.8" />
    <Require feature="mytest" />
  </ModulePrefs>
  <Content type="html">
  <![CDATA[
<script type="text/javascript">
    _IG_RegisterOnloadHandler(init__MODULE_ID__);

    function init__MODULE_ID__() {
        MyTest.testIt(receiveMyTest, "this message");
    }

    function receiveMyTest(data) {
        alert(data);
    }

</script>
  ]]>
  </Content>
</Module>
==EOF==