I am trying to hack together a Canvas App so I can understand the Publish/Subscribe Model. I have a VF page in a dev org calling a URL in a SFDC Prod Org (so it has HTPPS) that just displays another VF page. I can get the basic samples in the docs to work (re-size/alert for Chatter users) but I cannot for the life of me get the VF page to publish, and my other page to subscribe...I just get an error from the CanvasApp Page in the console saying
Uncaught precondition fail
EDIT: The Canvas docs suggest I need include a reference to Controller.js - but the links they provide go nowhere - anyone know if this is still true, and if so, where I can find it?
VF Page in Org Using Canvas App:
<apex:page >
<script type="text/javascript" src="/canvas/sdk/js/29.0/canvas-all.js"/>
<apex:canvasApp applicationName="pnctest1" height="800px" parameters="{p1:'value1',p2:'value2',p3:'value3'}"/>
<script>
Sfdc.canvas (function () {
Sfdc.canvas.client.publish(
{name: 'pnc.testAction', payload: {}
});
});
</script>
</apex:page>
VF Page in Org Hosting Canvas App:
<apex:page controller="oAuthSetupforZDM" cache="FALSE">
<script type="text/javascript" src="https://na15.salesforce.com/canvas/sdk/js/29.0/canvas-all.js"/>
<script>
var sJson = [Working JSON Request];
var sr = JSON.parse(sJson);
Sfdc.canvas (function () {
Sfdc.canvas.client.resize(sr.client, {height : "225px"});
Sfdc.canvas.client.subscribe({name : 'pnc.testAction',
onData : function (e) {
}
});
});
</script>
</apex:page>