Restful Client

15 views
Skip to first unread message

kenny

unread,
Nov 24, 2009, 9:38:34 AM11/24/09
to EventMachine
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?
Reply all
Reply to author
Forward
0 new messages