I'm writing a simple socket based client that will read some data,
transform it to JSON, then send it off to a sinatra web service. I
was trying to figure out how I'm supposed to be doing these one off
POSTs within a running EM
within the
class Handler < EventMachine::Connection
def receive_data( data )
# assuming data is all there
json = convert_to_json( data )
conn = EM::Protocols::HttpClient2.connect 'localhost', '4567'
req =
conn.post( "/url/#{json}" )
end
end
Is this the right way? Can I just use Rest Client, or would that
conflict with EM?