如何使用easyXDM动态更新消费者的位置?
我尝试了以下代码但没有成功。
提供商
var socket = new easyXDM.Socket({
onReady: function(){
socket.postMessage("update-remote");
},
onMessage: function(message, origin) {
alert("received " + message + " from " + origin);
}
});
消费
var socket = new easyXDM.Socket({
remote: "http://remotedomain/page1.html",
remoteHelper: "http://remotedomain/name.html",
onReady: function(){
socket.postMessage("foo-message");
},
onMessage: function(message, origin) {
if(message="update-remote") {
this.remote = "http://remotedomain/page2.html",
}
alert("received " + message + " from " + origin);
}
});