Sha256: bd991fc82dd8224a36103a718884075d807f40af447c3124fcb332891a1af318
Contents?: true
Size: 831 Bytes
Versions: 2
Compression:
Stored size: 831 Bytes
Contents
module Sinatra module RocketIO def self.registered(app) app.helpers Sinatra::RocketIO::Helpers EM::defer do while !EM::reactor_running? do sleep 1 end if options[:comet] require 'sinatra/cometio' app.register Sinatra::CometIO end if options[:websocket] require 'sinatra/websocketio' app.register Sinatra::WebSocketIO end app.get '/rocketio/rocketio.js' do content_type 'application/javascript' @js ||= ERB.new(Sinatra::RocketIO.javascript).result(binding) end app.routes["GET"].delete_if{|route| "/cometio/cometio.js" =~ route[0] or "/websocketio/websocketio.js" =~ route[0] } Sinatra::RocketIO.emit :regist_events end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sinatra-rocketio-0.0.4 | lib/sinatra-rocketio/application.rb |
sinatra-rocketio-0.0.3 | lib/sinatra-rocketio/application.rb |