IO.select([server] + clients) ready[0].each do |socket| if socket == server clients << socket.accept_nonblock else data = socket.recv_nonblock(256) if data.size > 0 socket.sendmsg_nonblock(data) else clients.delete(socket) end end end end
=> '-85.871227', :radius => 50 } head = { :accept => 'application/json' } http = EventMachine::HttpRequest.new("http://api.gowalla.com/spots"). get(:query => query, :head => head) http.callback do data = Yajl::Parser.parse(http.response) data['spots'].each do |spot| # American Legion Public Pool @ 37.705699083:-85.8540598 puts "#{spot['name']} @ #{spot['lat']}:#{spot['lng']}" end end end
=> "[username:password]" ) stream.each_item do |item| tweet = Yajl::Parser.parse(item) # {"text"=>"So.. I just found out Justin Bieber's in the...} puts tweet.inspect end # stream.on_error # stream.on_max_reconnects end