Another method of handling the live data using the ThreadWatch module.
require 'rubygems' require 'sinatra' require 'json' require 'livedata' get '/live_data/:user_id' do wait_time = params[:wait_time] || 15 obj = LiveData::ThreadWatch.read( params[:user_id] ) obj.to_json end get '/live_data/:user_id/put' do obj = LiveData::ThreadWatch.write( params[:user_id], params.dup ) "OK" end
There was an error while loading. Please reload this page.