Sha256: 4e7b599cec9a5b3ecf212f5cbedfe770b433f9e4e2085e4e1873ee82f36d970e

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 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
        Sinatra::RocketIO.emit :regist_events
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra-rocketio-0.0.2 lib/sinatra-rocketio/application.rb