asynchronous http request in ruby

后端 未结 3 1611
情深已故
情深已故 2020-12-05 17:51
 require \'net/http\'

urls = [
  {\'link\' => \'http://www.google.com/\'},
  {\'link\' => \'http://www.facebook.com/\'},
 {\'link\' => \'http://www.yahoo.c         


        
3条回答
  •  孤城傲影
    2020-12-05 18:14

    Lightweight Async handling is the job of Threads (as you said) or Fibers.

    Otherwise, you should consider EventMachine which is a very powerful tool.

    EDIT: The above URL for Event Machine is dead. Here is their GitHub account, https://github.com/eventmachine/eventmachine . It serves as a good starting point.

提交回复
热议问题