I have got 2 IFrames on a host Page and wanted to set up the bi-directional channel between Host page and IFrames. For that I used easyXDM Interface class and was able to set up the communication between the host page and iFrames.
Host page is on one domain and all the IFrames are on the different domain but the all the 3 IFrames are on the same domain.
I had set up 2 channels on the host page using easyXDM interface class and specified the required properties like what local methods , remote methods etc..
Host page has got local method called publish, and this publish method is remote on all the IFrames.
The problem I am getting is that when the publish method is called from one IFrame , the publish is called for all the IFrames channel on the host page.
Code on the Host page looks like :
channel1 = new easyXDM.Interface(
{
local: "/name.html",
remote: "PathToIFrame1.html",
container: document.getElelmentById('Div1')
}
, {
remote: {
receive: {}
},
local: {
publish: { method: function () { } }
}
}
);
channel2 = new easyXDM.Interface(
{
local: "/name.html",
remote: "PathToIFrame2.html",
container: document.getElelmentById('Div2')
}
, {
remote: {
receive: {}
},
local: {
publish: { method: function () { } }
}
}
);
and code on IFrame side looks like :
remote = new easyXDM.Interface({},
{
remote: {
publish: {
isVoid: true
}
},
local: {
Receive: {
isVoid: true,
method: function (a, b) {
}
}
}
});
}
and when publish method is called from IFrame side , publish methods of channel1 and channel2 (on the host side ) both gets called.
Can someone please suggest what could be wrong here.