Skip to content

Instantly share code, notes, and snippets.

@lifo
Created April 23, 2010 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lifo/376066 to your computer and use it in GitHub Desktop.
Save lifo/376066 to your computer and use it in GitHub Desktop.
require 'cramp/controller'
require 'cramp/model'
require 'twitter'
module Twisocket
class Socket < Cramp::Controller::Websocket
before_start :set_twitter
# Probably cramp should fire all the timer methods before scheduling them via EM periodic timers
on_start :check_tweets
periodic_timer :check_tweets, :every => 30
def set_twitter
@twitter = Twitter.user('dmathieu')
end
def check_tweets
render @twitter.status.text
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment