Skip to content

Instantly share code, notes, and snippets.

@ujifgc
Created November 21, 2011 08:11
Show Gist options
  • Save ujifgc/1382003 to your computer and use it in GitHub Desktop.
Save ujifgc/1382003 to your computer and use it in GitHub Desktop.
async example app
class Swift < Padrino::Application
register Padrino::Rendering
register Padrino::Helpers
enable :sessions
get '/' do
EM.add_timer(1) do
$check ||= 0
$check += 1
env['async.callback'].call([200, {'Content-Type' => 'text/plain'}, "hello #{$check}"])
end
throw :async
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment