This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 60900d8ba0412258e1064b0263deab17bd90c8b2
tree 7656098c91c95dc7327f1259ffdf07e9d8b166a1
parent 9232ecc3c32e8aeec052557061c889290350fcd4
tree 7656098c91c95dc7327f1259ffdf07e9d8b166a1
parent 9232ecc3c32e8aeec052557061c889290350fcd4
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon Aug 18 18:27:31 -0700 2008 | |
| |
MIT-LICENSE | Sun Aug 17 20:49:25 -0700 2008 | |
| |
README.rdoc | Wed Aug 20 17:20:44 -0700 2008 | |
| |
Rakefile | Mon Aug 18 23:16:10 -0700 2008 | |
| |
VERSION | Tue Aug 19 00:00:06 -0700 2008 | |
| |
evented_net.gemspec | Tue Aug 19 00:00:06 -0700 2008 | |
| |
examples/ | Mon Aug 18 18:27:31 -0700 2008 | |
| |
ext/ | Mon Aug 18 18:27:31 -0700 2008 | |
| |
lib/ | Mon Aug 18 22:14:01 -0700 2008 | |
| |
spec/ | Mon Aug 18 22:14:01 -0700 2008 |
README.rdoc
Introduction
This library enables you to make evented HTTP calls if an EventMachine reactor is running.
If not, it falls back to a regular synchronous HTTP call. In both cases, you specify a proc which will be used as a callback with the HTTP code and the HTTP body being passed as parameters.
The aim of this library is to make a consistent API for both synchronous and evented HTTP calls.
Acknowledgement
The awesome blog post by Ilya Grigorik (www.igvita.com/2008/05/27/ruby-eventmachine-the-speed-demon/) really inspired me to dive into EventMachine, and the code samples that he’s posted have been a real Godsend.
Sample Code which uses EventedNet::HTTP POST call
require 'rubygems'
require 'evented_net'
require 'evma_httpserver'
require 'cgi'
class Handler < EventMachine::Connection
include EventMachine::HttpServer
def process_evented_http_req(code, body)
puts "Code: #{code} Body: #{body}"
end
def process_http_request
uri = URI.parse('http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi')
EventedNet::HTTP.post(uri, :callback => method(:process_evented_http_req), :params => {:Comments => 'Testing Attention Please'})
end
end
EventMachine::run {
# When running on Mac OS X, use EventMachine.kqueue
# When running on Linux 2.6.x kernels, use EventMachine.epoll
EventMachine.kqueue
EventMachine::start_server("0.0.0.0", 8082, Handler)
puts "Listening"
}







