Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby
Tree: d9a247b73c

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app/controllers/facebook_realtime
lib
.gitignore
Gemfile
README.rdoc
Rakefile
facebook_realtime.gemspec

README.rdoc

Facebook RealTime

Facebook RealTime is a rails wrapper around facebook Real-time Update API.

Facebook Real-Time Update API

developers.facebook.com/docs/api/realtime

Facebook Graph API

For an overview of what this is all about, see developers.facebook.com/docs/api.

Installation

Create new Controller

Controller must inherit FacebookRealTime::SubscriptionsController

  • facebook_check is a callback URL to which Facebook will get subscription validation.

  • facebook_update is callback URL to which Facebook will post subscription updates.

Add two routes :get and :post

open your routes.rb and add

  • match '/endpoint' => 'controller_name#facebook_check', :via => [:get]

  • match '/endpoint' => 'controller_name#facebook_update', :via => [:post]

Create variables :

  • FB['id'] : facebook application id

  • FB['secret'] : facebook application secret

  • FB['verify_token'] : A subscriber-provided opaque token that will be echoed back in the verification request to assist the subscriber in identifying which subscription request is being verified. If this is not included, no token will be included in the verification request. This is from the PubSubHubbub spec.

Deploy your app

Before using gem you have to deploy a valid check method, to add new subscriptions

Use rake tasks :

  • rake fb:rt:list to show your subscriptions

  • rake fb:rt:delete to delete all your subscription

  • rake fb:rt:subscribe to add or a modify a subscription

  • params

    • object

      • facebook object name eg : user, …

    • fields:

      • list of fields with ',' as separator eg : “likes, info”

    • callback_url:

      • url bringing to your check method

Something went wrong with that request. Please try again.