我在 gupshup 中轮询通知的 url,在收到通知后,我正在执行 context.sendResponse 以在 bot 上显示它。但是在 context.sendResponse 之后,会听取更多通知,我可以在日志中看到这些通知,但它们是即使提供了 context.sendResponse 也不会显示到机器人中。我们如何解决这个问题或者我们如何使用 gupshup 有效地进行轮询
function pollForNotifications(context, XMLHttpRequest, to_json) {
timer = setInterval(function() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState === 4) {
to_json(this.responseText, function(error, data) {
var json = data.rss.channel.item;
if (lastRecievedData == null) {
//some logic
context.sendResponse(info);
} else {
//some logic
context.sendResponse(info);
}
});
}
};
xhr.open("GET", "rally1.rallydev.com/slm/rss/notifications/All.rss");
xhr.send();
}, 5000);
}
我正在为通知投票集会,在收到回复后,我将其显示在机器人上。当一个机器人启动时,它会监听通知并且通知会显示在机器人上。收到了进一步的通知,我可以在日志中检查收到的通知,日志说响应已发送到机器人,但机器人仍然没有显示任何响应