This is a container for the synchronous WHOIS gem which replaces socket communications with the EventMachine equivalent. The result is a gem permitting asynchronous WHOIS lookups.
em-whois
is EventMachine-aware, meaning that it'll use asynchronous sockets when called
inside the reactor, and fallback to original sockets outside the reactor context.
Tested and used in production with MRI 1.9+.
em-whois
relies on Ruby Fibers and em-synchrony
, imposing a 1.9+ requirement.
Simple example to check domain availability via WHOIS within the EventMachine loop:
require 'em-whois'
EM.synchrony do
whois = Whois.whois(ARGV[0] || "github.com")
puts whois.properties[:available?] ? "Domain Available" : "Domain Taken"
EM.stop
end
Also take a look at examples/async_whois.rb
.
The MIT License - Copyright (c) 2012 Mike Jarema