I'm trying to generate a realtime updates subscription using the Koala gem deployed on Heroku. However, when I run the following:
@updates = Koala::Facebook::RealtimeUpdates.new(:app_id => APP_ID, :secret => APP_SECRET) @updates.subscribe("user", "feed", CALLBACK_URL, VERIFY_TOKEN)
at the heroku console, I get:
! Internal server error
However, when I check my Heroku logs, I don't see a 500 error. In fact, everything seems hunky-dori:
heroku[router]: GET blah-blah-760.heroku.com/facebook_updates/ dyno=web.1 queue=0 wait=0ms service=5951ms status=200 bytes=10
heroku[nginx]: 66.220.149.250 - - [05/Oct/2011:11:55:11 -0700] "GET /facebook_updates/?hub.mode=subscribe&hub.challenge=1234567890&hub.verify_token=XXXXXXX HTTP/1.0&quo开发者_JS百科t; 200 10 "-" "facebookplatform/1.0 (+http://developers.facebook.com)" blah-blah-760.heroku.com
When I paste the GET request into the browser, it echoes the hub.challenge parameter correctly.
My controller is as follows:
class FacebookUpdatesController < ApplicationController
layout nil
def index #this method responds to the Facebook GET
logger.info "about to meet challenge"
render :text => Koala::Facebook::RealtimeUpdates.meet_challenge(params, VERIFY_TOKEN)
end
def create #this method responds to POST messages
logger.info params
end
end
My routes are configured as follows:
resources :facebook_updates, :only => [:create, :index]
I feel like I'm really close. Any help would be greatly appreciated.
It can't handle the both requests at the same time, if you run the @updates.subscribe("user", "feed", CALLBACK_URL, VERIFY_TOKEN)
at a local console it will work.
精彩评论