PubSubHubbub 和 Ruby on Rails:订阅验证
我正在尝试使用 PubSubHubbub 和 Ruby 实现 Superfeedr 订阅导轨。问题是,即使我的回调打印出它成功接收的 hub.challenge 字符串,订阅也永远不会被确认。
def push
feed = Feed.find(params[:id])
if feed.present?
if params['hub.mode'].present? and params['hub.verify_token'] == feed.secret
feed.update_attribute(:is_active, (params['hub.mode'] == 'subscribe'))
render text: params['hub.challenge']
return
elsif params['hub.secret'] == feed.secret
parse(feed, request.raw_post)
end
end
render nothing: true
end
它设置 feed.is_active = true,但 Superfeedr Analytics 没有显示订阅迹象。
我正在使用 1 dyno Heroku 托管和异步验证方法。
I am trying to implement Superfeedr subscriptions using PubSubHubbub and Ruby on Rails. The problem is, the subscriptions are never confirmed, even though my callback prints out the hub.challenge string, which it successfully receives.
def push
feed = Feed.find(params[:id])
if feed.present?
if params['hub.mode'].present? and params['hub.verify_token'] == feed.secret
feed.update_attribute(:is_active, (params['hub.mode'] == 'subscribe'))
render text: params['hub.challenge']
return
elsif params['hub.secret'] == feed.secret
parse(feed, request.raw_post)
end
end
render nothing: true
end
It sets feed.is_active = true, but Superfeedr Analytics shows no sign of subscription.
I am using 1 dyno Heroku hosting and async verification method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该检查的第一件事是 HTTP 状态代码和订阅请求的响应正文。我预计代码为 422 表示订阅失败,但正文将帮助我们准确了解发生了什么。
另外,您在日志中看到验证请求吗?
Heroku 的一个常见问题是,如果您使用 hub.verify=sync,您将需要 2 个 dyno,因为在这种情况下您必须并发请求......
The first thing you should check is the HTTP status code and the response BODY of your subscription request. I expect the code to be 422 to indicate that subscription was failed, but the body will help us know exactly what is going on.
Also, do you see the verification request in the logs?
A common issue with heroku is that if you use hub.verify=sync, you will need 2 dynos, because you have to concurrent requests in this case...