【发布时间】:2014-04-03 01:46:22
【问题描述】:
我花了一整天的时间尝试将消息发布到 2 个频道,..但我可以做到..
当我尝试使用一个频道发布时,我收到了回电..但不是在两个频道中..我犯了什么错误..
这是我的代码..
pubnub.subscribe({
channel : channel_name1,
connect : function() {
Ti.API.info('Entered Chat...');
},
presence : function(m) {
Ti.API.info('presence..' + JSON.stringify(m));
},
disconnect : function() {
Ti.API.info("Connection Lost.");
},
reconnect : function() {
Ti.API.info("And we're Back!")
},
callback : function(message) {
Ti.API.info(message);
},
error : function() {
Ti.API.info("Lost Connection !!");
},
});
现在我像这样发布..
pubnub.publish({
channel :[ channel_name1, channel_name2],
message : {
text : message,
},
callback : function(info) {
if (!info[0])
setTimeout(function() {
send_a_message(message);
}, 2000);
}
});
}
【问题讨论】: