Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Best HTTP Released

Discussion in 'Assets and Asset Store' started by BestHTTP, Sep 11, 2013.

  1. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    syscrusher and Cromfeli like this.
  2. b43-14brett647

    b43-14brett647

    Joined:
    Sep 9, 2015
    Posts:
    14
    Oh wow it actually works this time. Thanks!
     
    Cromfeli likes this.
  3. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    351
    Hi there! After update to the latest version my download progress becomes more sharp and choppy, than before. How to make it smooth again?
    Before

    After


    Code
    Code (CSharp):
    1.  
    2. httpRequest.OnStreamingData += (req, resp, data, dataLength) => {
    3.     if (resp.IsSuccess)
    4.     {
    5.         // Write out the downloaded data to a file:
    6.         if (data != null)
    7.         {
    8.             using (FileStream fs = new FileStream(fileName, FileMode.Append))
    9.             {
    10.                 fs.Write(data, 0, dataLength);
    11.             }
    12.         }
    13.     }
    14.     else
    15.     {
    16.         //error handling
    17.  
    18.         return false;
    19.     }
    20.  
    21.     return true;
    22. };
    23.  
    24.  
    25. httpRequest.OnDownloadProgress = (req, downloaded, length) => { onTrackLoadingProgress(downloaded / (float) length); };
    26. httpRequest.StreamFragmentSize = 1 * 1024 * 1024; // 1 megabyte
    27. httpRequest.DisableCache = true; // already saving to a file, so turn off caching
    28. httpRequest.Send();
     
  4. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @justtime

    Do you use the OnDownloadProgress event to show the animation? That event usually fired more frequently than the OnStreamingData and doesn't depend on streaming settings.

    You can set the plugin's log level and send the logs to me. You can read about logging and where you can find the logs files here: https://besthttp-documentation.readthedocs.io/en/latest/#7. Global Topics/Logging/

    Edit: you shouldn't open the file in the OnStreamingData callback. You should create it once, and close it in the request's callback.
     
  5. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    351
    In my case seems that it depends on StreamFragmentSize settings, because when i decrease this value, it is called more often.
    I have sent log file to you via pm.
    About file, do you mean something like this?
    Code (CSharp):
    1. FileStream fs = null;
    2. ...
    3. //in OnFinishedCallback
    4. fs?.Dispose();
    5. ...
    6. //in OnStreamingData Callback
    7. if (fs == null)
    8.                 {
    9.                     fs = new FileStream(fileName, FileMode.Append);
    10.                 }
    11. if (resp.IsSuccess)
    12.                 {
    13.                     // Write out the downloaded data to a file:
    14.                     if (data != null)
    15.                     {
    16.                         fs.Write(data, 0, dataLength);
    17.                     }
    18.                 }else
    19.                 {
    20. ...
    21. fs?.Dispose();
    22. }
     
  6. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @justtime

    Here's what i'm thought about:
    Code (CSharp):
    1.  
    2. var request = new HTTPRequest(new Uri(url), OnRequestFinished);
    3.  
    4. request.OnDownloadProgress = (req, down, length) => Debug.LogFormat("{0}", down / (float)length);
    5. request.OnStreamingData += OnData;
    6.  
    7. request.StreamFragmentSize = 1024 * 1024;
    8.  
    9. request.Send();
    10.  
    11. private bool OnData(HTTPRequest req, HTTPResponse resp, byte[] dataFragment, int dataFragmentLength)
    12. {
    13.     if (resp.IsSuccess)
    14.     {
    15.         var fs = req.Tag as System.IO.FileStream;
    16.         if (fs == null)
    17.             req.Tag = fs = new System.IO.FileStream("fileName", System.IO.FileMode.Create);
    18.  
    19.         fs.Write(dataFragment, 0, dataFragmentLength);
    20.     }
    21.  
    22.     // Return true if dataFrament is processed so the plugin can recycle the byte[]
    23.     return true;
    24. }
    25.  
    26. private void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
    27. {
    28.     var fs = req.Tag as System.IO.FileStream;
    29.     if (fs != null)
    30.         fs.Dispose();
    31.  
    32.     switch (req.State)
    33.     {
    34.         // The request finished without any problem.
    35.         case HTTPRequestStates.Finished:
    36.             if (resp.IsSuccess)
    37.             {
    38.                 Debug.Log("Done!");
    39.             }
    40.             else
    41.             {
    42.                 Debug.LogWarning(string.Format("Request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",
    43.                                                 resp.StatusCode,
    44.                                                 resp.Message,
    45.                                                 resp.DataAsText));
    46.             }
    47.             break;
    48.  
    49.         default:
    50.             {
    51.                 // There were an error while downloading the content.
    52.                 // The incomplete file should be deleted.
    53.                 System.IO.File.Delete("filename");
    54.             }
    55.             break;
    56.     }
    57. }
     
    Cromfeli likes this.
  7. soraphol

    soraphol

    Joined:
    May 8, 2018
    Posts:
    1
    Hello BestHTTP,

    Currently, I am using UnityWebRequest to download Csv files and asset bundles from a remote server. However, it seems that UnityWebRequest might not work properly for some Android devices from certain countries such as India and Pakistan. A lot of users are facing "Cannot resolve destination host" error; thus, I am migrating to BestHTTP. After doing some research, I still cannot find an alternative way to get asset bundle except via UnityWebRequest or WWW. Is there anyway to download asset bundle using BestHTTP instead of standard Unity's methods? Thank you.
     
  8. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @soraphol

    You can use the downloaded raw bytes to create an asset bundle:
    Code (CSharp):
    1. // Start creating the downloaded asset bundle
    2. AssetBundleCreateRequest async =
    3. #if UNITY_5_3_OR_NEWER
    4.     AssetBundle.LoadFromMemoryAsync(request.Response.Data);
    5. #else
    6.     AssetBundle.CreateFromMemory(request.Response.Data);
    7. #endif
    8.  
    9. // wait for it
    10. yield return async;
    11.  
    12. BestHTTP.PlatformSupport.Memory.BufferPool.Release(request.Response.Data);
    13.  
    14. // And process the bundle
    15. yield return StartCoroutine(ProcessAssetBundle(async.assetBundle));
    (From my AssetBundleSample)
     
    soraphol likes this.
  9. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    351
    Hi! But i replace Unity methods to BestHTTP can i use Caching.IsVersionCached for asset bundle? Or i have to write my own cache it this case, and if so, could you give an advice how to properly make it?
     
  10. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @justtime

    If the server sends the proper caching headers, the plugin will store the content locally and serve it from there. There's no IsVersionCached, as for the plugin all content are equal it will validate only the headers when a request is sent out. Also, caching is transparent, the very same code can be used and the plugin downloads, update, validates content.
     
    justtime likes this.
  11. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    351
    What if want to pass "fileName" like a param, not a global var, can i use something like Tag? And should i Dispose resp when Finished?
     
    Last edited: Nov 29, 2019
  12. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @justtime

    You can add anything to the Tag property, the plugin doesn't uses it. It's just there for user code to pass any information with the request to its callbacks.
    You can modify the previous code to something like this:
    Code (CSharp):
    1. public sealed class DownloadTask
    2. {
    3.     public string Url;
    4.     public string FileName;
    5.     public System.IO.FileStream Stream;
    6.  
    7.     public Action<DownloadTask> Callback;
    8.  
    9.     // add fields as required
    10.  
    11. }
    12.  
    13. var task = new DownloadTask { Url = "...", FileName = "..." };
    14. task.Callback = t => Debug.LogFormat("Task '{0}' is done!", t.FileName);
    15.  
    16. var request = new HTTPRequest(new Uri(task.Url), OnRequestFinished);
    17.  
    18. request.OnDownloadProgress = (req, down, length) => Debug.LogFormat("{0}", down / (float)length);
    19. request.OnStreamingData += OnData;
    20.  
    21. request.StreamFragmentSize = 1024 * 1024;
    22.  
    23. request.Tag = task;
    24.  
    25. request.Send();
    26.      
    27. private bool OnData(HTTPRequest req, HTTPResponse resp, byte[] dataFragment, int dataFragmentLength)
    28. {
    29.     if (resp.IsSuccess)
    30.     {
    31.         var task = req.Tag as DownloadTask;
    32.         if (task.Stream == null)
    33.             task.Stream = new System.IO.FileStream(task.FileName, System.IO.FileMode.Create);
    34.  
    35.         task.Stream.Write(dataFragment, 0, dataFragmentLength);
    36.     }
    37.  
    38.     // Return true if dataFrament is processed so the plugin can recycle the byte[]
    39.     return true;
    40. }
    41.  
    42. private void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
    43. {
    44.     var task = req.Tag as DownloadTask;
    45.     if (task.Stream != null)
    46.         task.Stream.Dispose();
    47.  
    48.     switch (req.State)
    49.     {
    50.         // The request finished without any problem.
    51.         case HTTPRequestStates.Finished:
    52.             if (resp.IsSuccess)
    53.             {
    54.                 if (task.Callback != null)
    55.                     task.Callback(task);
    56.             }
    57.             else
    58.             {
    59.                 Debug.LogWarning(string.Format("Request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",
    60.                                                 resp.StatusCode,
    61.                                                 resp.Message,
    62.                                                 resp.DataAsText));
    63.             }
    64.             break;
    65.  
    66.         default:
    67.             {
    68.                 // There were an error while downloading the content.
    69.                 // The incomplete file should be deleted.
    70.                 System.IO.File.Delete(task.FileName);
    71.             }
    72.             break;
    73.     }
    74. }
     
    justtime likes this.
  13. cgklutts

    cgklutts

    Joined:
    Jun 3, 2014
    Posts:
    12
    [637108008029818998] Ex [PollingTransport]: ParseResponse - Message: 1: Non-negative number required.

    Can't get this to work even in a simplistic form. What would cause this error?
     
  14. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  15. cgklutts

    cgklutts

    Joined:
    Jun 3, 2014
    Posts:
    12
  16. wechat_os_Qy04EV9MQdFdFRket_80b8dn4

    wechat_os_Qy04EV9MQdFdFRket_80b8dn4

    Joined:
    Dec 3, 2019
    Posts:
    1
    @BestHTTP
    hi, i need help



    An error occured: Request Finished with Error! Exception: TCP Stream closed unexpectedly by the remote server at BestHTTP.WebSocket.Frames.WebSocketFrame.Fragment (System.UInt16 maxFragmentSize) [0x00000] in <00000000000000000000000000000000>:0

    at BestHTTP.WebSocket.Frames.WebSocketFrame.Fragment (System.UInt16 maxFragmentSize) [0x00000] in <00000000000000000000000000000000>:0

    at BestHTTP.WebSocket.WebSocketResponse.ReceiveThreadFunc () [0x00000] in <00000000000000000000000000000000>:0

    at System.Threading.Tasks.Task.Execute () [0x00000] in <00000000000000000000000000000000>:0

    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0

    at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0

    at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0

    at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00000] in <00000000000000000000000000000000>:0

    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 , Status_Logined

    Stacktrace is not supported on this platform.

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)


    When this happened, it like the httprequest thread is down, all the http request will get the Abort State, i try to read the source, but i can't find the reason, please help me
     
  17. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    830
    Hi there, we're using besthttp + socket io to communicate with our 'social' server. (Heroku hosted). The game also supports multiplayer via photon. Our socket io connection is very shakey. It constantly drops out and has to reconnect. We know it has nothing to do with the users internet connection because in the middle of a live multiplayer game the socket connection to our social servers will be dropped and have to reconnect while the live photon game continues just fine. This happens multiple times per play session. Is there anything we can do to make our connection more robust? We thought maybe device hitches were causing disconnections so we made BestHTTP run threaded in the background but that hasn't helped. Our timeout is set to 10 seconds on the socket manager which is a very long time for the connection to stall while the game is clearly connected to the internet.
     
  18. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  19. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  20. Jack_Zhu

    Jack_Zhu

    Joined:
    Jul 9, 2018
    Posts:
    3
    we use besthttp to request aws cdn,but result is "Request Finished with Error! Exception: Could not resolve host" ,Especially on the android platform ,the besthttp version is 1.11.0 (2019.01.21)
     
  21. Jack_Zhu

    Jack_Zhu

    Joined:
    Jul 9, 2018
    Posts:
    3
    @BestHTTP I need your help
     
  22. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @Jack_Zhu

    "Could no resolve host" can be that the DNS query can't resolve the host's IP address.
    You might try out the following line before you try to connect:
    Code (CSharp):
    1. BestHTTP.HTTPManager.ConnectTimeout = TimeSpan.Zero;
    If ConnectTimeout is Zero, the TcpClient going to take a different execution path that in some cases helped in DNS issues.
     
  23. Jack_Zhu

    Jack_Zhu

    Joined:
    Jul 9, 2018
    Posts:
    3
    @BestHTTP if i set BestHTTP.HTTPManager.ConnectTimeout = TimeSpan.Zero;,How do I set the timeout?only set Request.Timeout = TimeSpan.FromSeconds(10) ???

     
  24. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  25. Afroman

    Afroman

    Joined:
    Aug 17, 2013
    Posts:
    43
    In the newest version of BestHttp, an empty body is returned if you use set continueOnCaptureContext to false for async/await.

    var httpResponseAsync = await httpRequest.GetHTTPResponseAsync(cancellationToken).ConfigureAwait(false);

    This issue doesn't occur if you set set ConfigureAwait(true) or if you use the callback instead of async/await
     
  26. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @Afroman

    Sent a link to an updated package in private.
     
  27. Afroman

    Afroman

    Joined:
    Aug 17, 2013
    Posts:
    43
    @BestHTTP Just tested your updated package, it fixed the problem, thank you!
     
  28. dohaiha930

    dohaiha930

    Joined:
    Mar 27, 2018
    Posts:
    53
    Try to use BestHttp to some POST API from url, but it increase over 1 mb of my Android Game Size. Check source code, SSL Handler Folder is biggest size.
    And my question is can you make an option to remove features did't need to decrease library size?
     
  29. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  30. dohaiha930

    dohaiha930

    Joined:
    Mar 27, 2018
    Posts:
    53
  31. GWF

    GWF

    Joined:
    Jul 24, 2013
    Posts:
    11
    Hi,
    I'm currently having an issue with cookies and REST API due to CORS update in unity 2018.3.12.
    BESTHTTP worked fine before the server update.

    1. I can login to the server using chrome/Firefox by navigating to an address with login credentials in the URL string.
    2. I can then access other pages via direct URL. The browser has the login credential cookies stored from the server and lets me in.
    When i Use best HTTP I get a reply from the server on login and it looks like the cookies are there in the reply but now missing in the cookies folder? there is only 1k file that is empty.

    I get and error that "Authorization has been denied for this request" (which i get in a browser if i delete the cookies) I heard that there were CORS changes and some bugs were introduced where cookies did not get processed correctly due to a new SameSite property?
    https://bugs.webkit.org/show_bug.cgi?id=19818
    https://devblogs.microsoft.com/aspnet/upcoming-samesite-cookie-changes-in-asp-net-and-asp-net-core/
    https://auth0.com/blog/browser-behavior-changes-what-developers-need-to-know/

    Do you know anything about this "SameSite" issue and cookies, or have any insight into this?
    Do i need to handle the cookies myself?

    UPDATE.......
    I logged the headers and get a set-cookie header, it contains 2 values for cookies, the values get set but the cookies count = 0
    my 2 cookies data format is
    ServerUser=a5k...<cookie data>...5r; path=/; secure

    SERVER=4785...<cookie data>...G3; path=/; secure; HttpOnly; SameSite=None

    Thank you in advance @BestHTTP
     
    Last edited: Dec 21, 2019
  32. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @GWF

    What runtime are you experiencing this issue? CORS has effect under WebGL, but you also mention a cookies folder that doesn't exists under WebGL. I'm also not aware any CORS update in unity 2018.3.12 and how that would affect the plugin. CORS are enforced by the browser, not Unity.

    You can also record a verbose log of the plugin and send the logs to me. You can read about logging in the plugin and where you can find the log files here: https://besthttp-documentation.readthedocs.io/en/latest/#7. Global Topics/Logging/
     
  33. GWF

    GWF

    Joined:
    Jul 24, 2013
    Posts:
    11
    The App runs on IOS and I just parse a json string reply from the server.
    I get the message in Xcode debuger and in the editor debug "Authorization has been denied for this request.".

    What I found by logging...
    Besthttp finds the 2 cookies (same ones as in a browser).
    Besthttp parses the 2 cookies into 3 cookies

    I think the cookie format we now get from the server is causing my issue.

    A. In the log the 1st cookie is fully created with all the default parameters i.e. domain, expiration.
    B. The 2nd cookie only gets the name and value set then stops no other values are set.
    C. A 3rd cookie starts to be created called "SameSite" with all the cookie parameters and info from 2nd cookie.

    Cookie 1 from server (cookie string data redacted)
    SERVERUserInfo=AAAAAAAAAA; path=/; secure

    Cookie 2 from server

    SERVER=BBBBBBBBBB; path=/; secure; HttpOnly; SameSite=None

    Cookies Parsed
    Cookie 1 with paramaters (looks fine).
    Cookie 2 only name and value is set missing all other parameters
    Cookie 3 Name="SameSite" Value="" + parsed cookie 2 parameters.

    Besthttp Cookie that is sent back to the server on the next querry request
    Header(1/1): 'Cookie': 'SERVERUserInfo=AAAAAAAAAAA;SameSite=None'

    The 1st full cookie value is added
    The 2nd cookie name and value is never passed
    The 3rd cookie "SameSite" is added to the Cookie header at the end.
     
  34. GWF

    GWF

    Joined:
    Jul 24, 2013
    Posts:
    11
    :DSolved :D
    The 2nd cookie is now added correctly when contacting the server and the server allows for data to be transmitted back

    Added code to cookie.cs

    public string SameSite { get; private set; }

    Added an entry between lines 104-106
    this.SameSite ="None";

    Added at lines 206-208
    case "samesite":
    cookie.SameSite = "None";
    break;


    This is my temporary forced fix for a cookie with a "SameSite" entry for now
    @BestHTTP
     
  35. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @GWF

    Yes, that's basically what I did too.
     
  36. Afroman

    Afroman

    Joined:
    Aug 17, 2013
    Posts:
    43
    I'm getting an error when hitting the /negotiate endpoint for SignalR Core

    Code (CSharp):
    1. [637133349960379820] Err [HTTP2Stream]: [5] RST Stream frame ([HTTP2RST_StreamFrame Header: [HTTP2FrameHeaderAndPayload Length: 4, Type: RST_STREAM, Flags: 00000000, StreamId: 5, PayloadOffset: 0, DontUseMemPool: False], Error: PROTOCOL_ERROR(1)]) received in state HalfClosedLocal!
    2. UnityEngine.Debug:LogError(Object)
    3. BestHTTP.Logger.DefaultLogger:Error(String, String) (at Assets/ThirdParty/Best HTTP/Source/Logger/DefaultLogger.cs:76)
    4. BestHTTP.Connections.HTTP2.HTTP2Stream:ProcessIncomingFrames(List`1) (at Assets/ThirdParty/Best HTTP/Source/Connections/HTTP2/HTTP2Stream.cs:354)
    5. BestHTTP.Connections.HTTP2.HTTP2Stream:AddFrame(HTTP2FrameHeaderAndPayload, List`1) (at Assets/ThirdParty/Best HTTP/Source/Connections/HTTP2/HTTP2Stream.cs:184)
    6. BestHTTP.Connections.HTTP2.HTTP2Handler:RunHandler() (at Assets/ThirdParty/Best HTTP/Source/Connections/HTTP2/HTTP2Handler.cs:174)
    7. BestHTTP.Connections.HTTPConnection:ThreadFunc() (at Assets/ThirdParty/Best HTTP/Source/Connections/HTTPConnection.cs:117)
    8. BestHTTP.PlatformSupport.Threading.<>c__DisplayClass4_0:<RunLongLiving>b__0() (at Assets/ThirdParty/Best HTTP/Source/PlatformSupport/Threading/ThreadedRunner.cs:79)
    9. System.Threading.ThreadHelper:ThreadStart(Object)
    Code (CSharp):
    1.  
    2. BestHttpSignalRImplementation: Error: Negotiation Request Finished with Error! RST_STREAM frame received! Error code: PROTOCOL_ERROR(1)
    3. UnityEngine.Debug:LogError(Object)
    4. Portal.Services.MessagingService.BestHttpSignalRImplementation:Hub_OnError(HubConnection, String) (at Assets/Services/MessagingService/BestHttpSignalRImplementation.cs:210)
    5. BestHTTP.SignalRCore.HubConnection:SetState(ConnectionStates, String, Boolean) (at Assets/ThirdParty/Best HTTP/Source/SignalRCore/HubConnection.cs:1015)
    6. BestHTTP.SignalRCore.HubConnection:OnNegotiationRequestFinished(HTTPRequest, HTTPResponse) (at Assets/ThirdParty/Best HTTP/Source/SignalRCore/HubConnection.cs:387)
    7. BestHTTP.Core.RequestEventHelper:HandleRequestStateChange(RequestEventInfo) (at Assets/ThirdParty/Best HTTP/Source/Core/RequestEvents.cs:268)
    8. BestHTTP.Core.RequestEventHelper:ProcessQueue() (at Assets/ThirdParty/Best HTTP/Source/Core/RequestEvents.cs:220)
    9. BestHTTP.HTTPManager:OnUpdate() (at Assets/ThirdParty/Best HTTP/Source/HTTPManager.cs:350)
    10. BestHTTP.HTTPUpdateDelegator:Update() (at Assets/ThirdParty/Best HTTP/Source/HTTPUpdateDelegator.cs:165)
    11.  
    I can see that from Charles that the request was successful, and the access token was returned.
    This works as expected with the previous major version of BestHTTP (1.x). Any help would be greatly appreciated!
     
  37. MrBum

    MrBum

    Joined:
    Oct 7, 2016
    Posts:
    6
    @BestHTTP
    Hello, I using Besthttp to custom download assetbundle for addressable. I can't understand why this slow 5x than UnityWedrequest.
    Can you please help me have a look on this?
     
  38. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  39. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @MrBum

    Is your download is done over HTTPS?
     
  40. Afroman

    Afroman

    Joined:
    Aug 17, 2013
    Posts:
    43
    @BestHTTP

    I've sent you the logs and full URL in a private message.
     
  41. MrBum

    MrBum

    Joined:
    Oct 7, 2016
    Posts:
    6
    @BestHTTP Hello, I already send you private message. Pls check.
     
  42. erdogan_akgun

    erdogan_akgun

    Joined:
    Aug 28, 2018
    Posts:
    3
    Hi,
    We encountered a problem after we update the plugin to new version. From deprecated version(v1.x.x) to best http/2 (v2.0.3).
    Everything works well on android when we try download images with old version. We don't change any code. But callback doesn't called for each http request, after we updated to best http/2. We couldn't find any reproduce steps except killing application a few times. It's not working after a few retry and starting to work again with another relaunch.
     
  43. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  44. aaron45

    aaron45

    Joined:
    May 27, 2014
    Posts:
    3
    Hi, first of all, let me say its been a pleasure using this plugin, worth every penny !
    I recently updated our Unity from 5.6 to 2018.4.6f1, and as consequence decided to upgrade from besthttp/1 to besthttp/2 - works perfectly except for one issue -
    We use the plugin only for sending http request to our servers, but for some reason after playing our game for a while (which includes a lot of server requests) the CPU usage starts to increase with time to a point where our frame rate is down from 60 to 10.
    Upon profiling the issue we can see that the CPU usage is coming mostly from one place (about 80% of the cpu usage) - HTTTPUpdateDelegator.Update() - this pretty much renders our game unplayable after a while, is there any way we can troubleshoot the reason for this happening? or is there any documentation on that specific functionality that can elaborate on what can cause the Update() to consume high CPU ?
    Thanks in advance.

    Screen Shot 2020-01-05 at 17.19.52.png
     
  45. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  46. aaron45

    aaron45

    Joined:
    May 27, 2014
    Posts:
    3
  47. erdogan_akgun

    erdogan_akgun

    Joined:
    Aug 28, 2018
    Posts:
    3
    Thank you for your answer. I sent second mail yesterday that about exception.

    Exception:
    ProcessIncomingFrames - Message: 1: Index was out of range. Must be non-negative and less than the size of the collection

    Throwing from Assets/Best HTTP/Source/Connections/HTTP2/HeaderTable.cs:142
     
    Joker_Games likes this.
  48. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
  49. KylianCap

    KylianCap

    Joined:
    Sep 10, 2019
    Posts:
    1
    Hi,

    I'm using Best HTTP Socket IO implementation for my application and I wanted to correct some problems of lost packets I have when the network connectivity is unstable. I've seen the OfflinePackets mechanism but I don't really understand how the OfflinePackets list is handled in Best HTTP. I expected the packets to be saved and sent upon reconnection but it seems the list is cleared at each failed reconnection attempt. Am I missing something here ?

    Thanks in advance,
     
    Last edited: Jan 9, 2020
  50. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,492
    @KylianCap

    Clearing the list on a failed reconnent attempts wasn't intentional, sent a fixed package in private.
     
unityunity