lib/sinatra-rocketio/application.rb in sinatra-rocketio-0.0.9 vs lib/sinatra-rocketio/application.rb in sinatra-rocketio-0.1.0

- old
+ new

@@ -16,9 +16,18 @@ end app.get '/rocketio/rocketio.js' do content_type 'application/javascript' @js ||= ERB.new(Sinatra::RocketIO.javascript).result(binding) end + app.get '/rocketio/settings' do + content_type 'application/json' + @setting_json ||= ( + setting = {} + setting[:websocket] = websocketio_url if Sinatra::RocketIO.options[:websocket] + setting[:comet] = cometio_url if Sinatra::RocketIO.options[:comet] + setting.to_json + ) + end app.routes["GET"].delete_if{|route| "/cometio/cometio.js" =~ route[0] or "/websocketio/websocketio.js" =~ route[0] } Sinatra::RocketIO.emit :start end