There's been quite a bit of work on the RPC code in the OS 0.8 -> 0.9 time
frame, and in most situations the rpc file isn't being used anymore.

It took me a while to find out too (so I know how you feel about the lacking
documentation:), the way to make it work now is to emit a bit of javascript
after each iframe and include the #rpctoken in there, ie something like:

<iframe
        width="482"
        scrolling="no"
        height="200"
        frameborder="no"
src="http://example.org/gadgets/ifr?etc#rpctoken=1707975397";
        class="gadgets-gadget"
        name="remote_iframe_14020"
        id="remote_iframe_14020">
</iframe>

<script type="text/javascript">
  gadgets.rpc.setRelayUrl("remote_iframe_14020",
"http://example.org/gadgets/ifr?etc#rpctoken=1707975397";);
  gadgets.rpc.setAuthToken("remote_iframe_14020", "1707975397");
</script>

Example is a generized copy&paste from a random www.partuza.nl profile page
& you can check it's code for the complete iframe generation flow



On Thu, Sep 24, 2009 at 10:45 AM, Fayland Lam <[email protected]> wrote:

> well, basically I'm use the 'shindig-1.1-incubating-SNAPSHOT-php' for the
> requestSendMessage
>
> for example, the shindig domain is 'opensocial.example.com' and the app
> domain is 'app.example.com'.
> then in app.example.com we will use iframe to call opensocial.example.com
> the app xml contains something like:
>       <script type="text/javascript">
>           var init = function() {
>               SendMessage(1747383, 'blabla');
>           };
>           gadgets.util.registerOnLoadHandler(init);
>
> function SendMessage(friendId, fname) {
>
>   var recipient = new Array();
>   var message = new opensocial.newMessage(fname + ", You are invited to my
> room");
>   message.setField(opensocial.Message.Field.TITLE,"Test Invintation");
>
> message.setField(opensocial.Message.Field.TYPE,opensocial.Message.Type.NOTIFICATION);
>
> var onMessage = function(obj) {
>   if (obj.hadError()){
>       switch(obj.getErrorCode()) {
>           case opensocial.ResponseItem.Error.NOT_IMPLEMENTED:
>             alert('NOT_IMPLEMENTED');
>             break;
>           default:
>             alert('code: ' + obj.getErrorCode());
>             break;
>       };
>       return;
>   }
> };
>
>   recipient.push(friendId);
>   opensocial.requestSendMessage(recipient,message,onMessage);
> }
>
> and in the app.example.com we have
> app.example.com/gadgets/files/container/rpc_relay.html
>
> I debugged for a while and I put an alert in
> features/src/main/javascript/features/rpc/wpm.transport.js
> to debug the 'gadgets.json.stringify(rpc), relay'
> the relay is http://app.example.com/gadgets/files/container/rpc_relay.html
> the rpc string is somehow
> {"s":"requestSendMessage","f":"remote_iframe_5","c":2,"a":[[1747383],"fields_":{"body":"blabla,
> You ....
> it seems the "targetWin.postMessage(gadgets.json.stringify(rpc), relay);"
> does NOT send any request to the server. (I check the access_log of
> app.example.com and opensocial.example.com, but I don't see the rpc
> request and I don't see the rpc_relay.html neither).
>
> I tried FF3 and IE8, both is not working, anyone got any hint? the shindig
> config issue? or the app js issue? or what?
>
> Thanks.
>
> --
> Fayland Lam // http://www.fayland.org/
>
>

Reply via email to