<i id='f6YV6'><tr id='f6YV6'><dt id='f6YV6'><q id='f6YV6'><span id='f6YV6'><b id='f6YV6'><form id='f6YV6'><ins id='f6YV6'></ins><ul id='f6YV6'></ul><sub id='f6YV6'></sub></form><legend id='f6YV6'></legend><bdo id='f6YV6'><pre id='f6YV6'><center id='f6YV6'></center></pre></bdo></b><th id='f6YV6'></th></span></q></dt></tr></i><div id='f6YV6'><tfoot id='f6YV6'></tfoot><dl id='f6YV6'><fieldset id='f6YV6'></fieldset></dl></div>
  • <legend id='f6YV6'><style id='f6YV6'><dir id='f6YV6'><q id='f6YV6'></q></dir></style></legend>

    <small id='f6YV6'></small><noframes id='f6YV6'>

    • <bdo id='f6YV6'></bdo><ul id='f6YV6'></ul>

        <tfoot id='f6YV6'></tfoot>
      1. react native 中的并行获取请求

        时间:2023-10-02
        1. <tfoot id='RIt7q'></tfoot>

                  <tbody id='RIt7q'></tbody>
                <i id='RIt7q'><tr id='RIt7q'><dt id='RIt7q'><q id='RIt7q'><span id='RIt7q'><b id='RIt7q'><form id='RIt7q'><ins id='RIt7q'></ins><ul id='RIt7q'></ul><sub id='RIt7q'></sub></form><legend id='RIt7q'></legend><bdo id='RIt7q'><pre id='RIt7q'><center id='RIt7q'></center></pre></bdo></b><th id='RIt7q'></th></span></q></dt></tr></i><div id='RIt7q'><tfoot id='RIt7q'></tfoot><dl id='RIt7q'><fieldset id='RIt7q'></fieldset></dl></div>
              • <legend id='RIt7q'><style id='RIt7q'><dir id='RIt7q'><q id='RIt7q'></q></dir></style></legend>

                <small id='RIt7q'></small><noframes id='RIt7q'>

                • <bdo id='RIt7q'></bdo><ul id='RIt7q'></ul>
                  本文介绍了react native 中的并行获取请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在 react native 中开发一个新应用程序,我需要将 20 次获取 并行到我的 api 中.当我在电话间隙中进行开发时,我可以创建 20 个 web workers 来让 Ajax 调用并行发生.当我在 react native 中并行执行 20 fetches 时,看起来每次获取都比以前花费更长的时间.就像它有一个提取队列并且它不会一起运行它们.

                  I am developing a new app in react native and I need to make 20 fetches to my api in parallel. When I developed in phone gap, I could create 20 web workers for the Ajax calls to happen parallel. When I am executing 20 fetches in parallel in react native it looks like every fetch is taking longer than the one before. Like it has a queue of fetches and it won't run them together.

                  有没有办法解决这个问题?现在,在我的 phonegap 应用程序 中完成提取需要 1 分钟,它需要 10 秒..非常感谢您的帮助

                  Is there any way to solve this? Now it takes like 1 minute to finish the fetches when in my phonegap app it takes like 10 secs.. Help would be much appreciated

                  推荐答案

                  iOS 中每个主机的连接数限制为四个.您需要在 NSURLSession 中增加 HTTPMaximumConnectionsPerHost.

                  The number of connections per host is limited to four in iOS. You need to increase HTTPMaximumConnectionsPerHost in NSURLSession.

                  测试这个丑陋的方法是直接将以下行添加到 node_modules/react-native/Libraries/Network/RCTHTTPRequestHandler.m:NSURLSessionConfiguration

                  The ugly way to test this is to directly add the following line to node_modules/react-native/Libraries/Network/RCTHTTPRequestHandler.m: NSURLSessionConfiguration

                  [configuration setHTTPMaximumConnectionsPerHost:25];
                  

                  阅读更多:https://developer.apple.com/documentation/foundation/nsurlsessionconfiguration/1407597-httpmaximumconnectionsperhost?language=objc

                  这篇关于react native 中的并行获取请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:JS fetch,没有得到响应的标题 下一篇:fetch POST 返回 HTTP 415,而 curl 继续正常并返回结果

                  相关文章

                      <small id='amLKE'></small><noframes id='amLKE'>

                      <i id='amLKE'><tr id='amLKE'><dt id='amLKE'><q id='amLKE'><span id='amLKE'><b id='amLKE'><form id='amLKE'><ins id='amLKE'></ins><ul id='amLKE'></ul><sub id='amLKE'></sub></form><legend id='amLKE'></legend><bdo id='amLKE'><pre id='amLKE'><center id='amLKE'></center></pre></bdo></b><th id='amLKE'></th></span></q></dt></tr></i><div id='amLKE'><tfoot id='amLKE'></tfoot><dl id='amLKE'><fieldset id='amLKE'></fieldset></dl></div>
                        <bdo id='amLKE'></bdo><ul id='amLKE'></ul>
                      <tfoot id='amLKE'></tfoot>
                      <legend id='amLKE'><style id='amLKE'><dir id='amLKE'><q id='amLKE'></q></dir></style></legend>