You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by John Hjelmstad <fa...@google.com> on 2009/09/09 01:56:25 UTC

rpc.js initialization improvements

All,

A while back, when making several functional improvements to the gadgets.rpc
library, I mentioned a desire to simplify the way the library is
initialized, so that it's significantly easier to use. In particular, the
concept of a "relay URL" is mostly antiquated at this point, due to RMR, and
the setAuthToken API can largely be automated. To this end, I've written
some code implementing a new such mechanism.

Code and full description at: http://codereview.appspot.com/116043/show

While the code is backward-compatible w/ existing uses, its new init routine
makes integration simple:

* Both sides include rpc.js. (gadgets.config NOT needed in child IFRAME, but
used if available)
* Container generates IFRAME with ID=<CHILD_ID>, URL like
http://child.com/path?query#parent=<CONTAINER_URL>&rpctoken=<RANDOM_STRING>,
and adds it to the DOM.
* Container calls gadgets.rpc.setupReceiver("<CHILD_ID>");

Subsequent initialization is automatic from this point.

Code review, design, and documentation feedback welcome.

Cheers,
John