Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Best HTTP Released

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

  1. Hyeongjik

    Hyeongjik

    Joined:
    Mar 8, 2016
    Posts:
    1
    Hi.
    Unity 2019.3 beta introduced Enter Play Mode Setting option in Project Setting->Editor. (fast enter play mode without domain reload / scene reload)
    https://forum.unity.com/threads/editor-domain-reload-and-or-scene-reload.680347/
    https://docs.google.com/document/d/...j-Pd9M71Uz9dc-dg4/edit#heading=h.2gazcsgmxkub

    Best HTTP library does not work properly in this option.
    because when editor enter play mode, static variables are not initalized.
    (especially HTTPManager, HTTPUpdateDelegator)
    Will you support this option?

    Maybe solution is writing static initialization function with attribute.
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
     
  2. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @Hyeongjik

    Yes, it will be supported in the next major version.
     
  3. Gorilla_Joes

    Gorilla_Joes

    Joined:
    Jul 22, 2015
    Posts:
    9
    Old version is now deprecated?
     
  4. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    Cromfeli likes this.
  5. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
  6. Gorilla_Joes

    Gorilla_Joes

    Joined:
    Jul 22, 2015
    Posts:
    9
    So this is a new purchase for old customers for essentially the same functionality? Or what is the plan?
     
  7. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @Gorilla_Joes

    On the surface it remained the same, there's only a few API changes. However under the surface there are a lot of changes. I had to rewrite most of the core parts of the plugin and had to implement ALPN in BouncyCastle to be able to support HTTP/2.

    Threading model also changed, it should have less bugs (race conditions) and more performant: no lock blocks are used in the plugin code, and where i have to use locking now i'm using a very lightweight ReaderWriterLockSlim.

    So yes, you can still create a new HTTPRequest and you get back a HTTPResponse, but between the two there's an almost one year of development to improve core parts of the plugin.
     
  8. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @Gorilla_Joes

    Also, anyone who purchased the old version don't have to pay the full price, as there's an upgrade path to the new asset. If you check my first post in this thread, you can see that the first version is released more than 6 years ago.
    Other than a light version ('Basic'), this is the first major asset upgrade of the plugin.
     
  9. Gorilla_Joes

    Gorilla_Joes

    Joined:
    Jul 22, 2015
    Posts:
    9
    Sounds good, I see the discount now. This asset has been well worth the purchase. :)
     
    Last edited: Nov 6, 2019
    BestHTTP likes this.
  10. AccentDave

    AccentDave

    Joined:
    Nov 16, 2015
    Posts:
    29
    Sorry for the newb question but I'm in a hurry and can't read 60 pages of forum: I'm looking for a simple way to run a web server from Unity (Android, specifically Quest). Meaning, I want to be able to have my Quest app serve a web page to a laptop/tablet on the same router. This would be like an admin dashboard, which can send data into my app on the Quest (to configure it) and read data out of my Quest (user status, maybe even screenshot/streaming video?) Can this plugin help with that?
     
  11. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @AccentDave

    Sorry, but this plugin is a client-only implementation, it can't act as a web server.
     
    AccentDave likes this.
  12. JoakimOlsson

    JoakimOlsson

    Joined:
    May 20, 2019
    Posts:
    11
    I have encountered an issue using BestHTTP 2 and I am not sure if it is because of a bug in my code, a bug in BestHTTP or if it is the server implementation that is not working properly. My application is using BestHTTP to talk to a server running SocketIO. The application is setup to start with polling as transport type and if possible, upgrade to websocket. The server supports websockets so the transport gets upgraded, as it should.

    The problem is that occasionally, about one in five tries, BestHTTP is sending a poll request with the polling transport while the connection is in the middle of being upgraded to websocket. When this occurs the following happens:
    1. No errors are immediately shown
    2. The custom subscription that has been submitted to the server does not work. The only subscriptions that appear to work are those created before the connection has been opened (based on what I have seen of the BestHTTP implementation when you subscribe to events should not matter?)
    3. After a short period of time the server responds with a 400, containing the following message: Polling - Request finished Successfully, but the server sent an error. Status Code: 400-Bad Request Message: Bad Request Uri: http://localhost:xxxx/socket.io/?EI...625387-3&sid=dd5b825528cb48ec9eb79630a0d9b8ea
    4. The client reconnects (I believe it use websocket right away, but not sure)
    5. The client still does not get any events from the custom subscription
    In order to better figure out the issue I customised the BestHTTP code a bit:
    I added a boolean to PollingTransport and check the value of that boolean at the start of PollingTransport.Poll(). If it is true, it does not fire a poll request. I set the value of that boolean to true in SocketManager.IManager.OnTransportConnect() as the transport type is being upgraded to websocket. Having done that I ran the application 20 times without encountering the issue mentioned above a single time (compared to the about 1/5 using standard BestHTTP implementation).

    So, what I am now wondering is.
    1. Is there any requirement / dependency in when / how my code subscribe / emits events?
    2. Is there a bug in BestHTTP (race condition / State flag not being set correctly)?
    3. Should the server implementation be able to handle this, having requests made on the polling connection while being in the process of setting up the websocket?
     
  13. ChewyMicha

    ChewyMicha

    Joined:
    Jul 2, 2018
    Posts:
    4
    Hey, we were wondering if we could use best HTTP/2 in our mobile app to continuously do speedtests to test the throughput of a wireless network?
    We also tought about using best HTTP/2 together with the functionality of iPerf to test the troughput.
    Do you think there is a way to do something like that? Or did someone ever tried something similar ?

    Thanks in advance
    Micha
     
  14. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @JoakimOlsson

    It would be possible to pack up a repro project (both server and client) and send over to me?
     
  15. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @ChewyMicha

    I think it could be used for speed test, but one the alternate TLS handler bundled with and used by default is quite slow. So even if the bandwidth would enable higher througput speed of the decryption could be a very noticable bottleneck.
     
  16. ChewyMicha

    ChewyMicha

    Joined:
    Jul 2, 2018
    Posts:
    4
    Just to clarify, we are in a local network so we dont need encryption. And we are using the older version of best HTTP Pro. Sorry if my first question was missleading. Do you have any other suggestions?

    Anyways, thanks for the fast answer.
    Micha
     
  17. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @ChewyMicha

    If you can use plain text http, then you can store when you sent out the request, and when its callback is called. You can access the downloaded bytes' length throught the httpresponse's data array then you can calculate the download speed. It's going to be a little misleading as it doesn't contain the size of the headers, but the downloaded data should be large enough anyway to make the header size neglecable.
    Using streaming you can discard the downloaded data instead of buffering up all of them.

    These should work no matter what version of the plugin are you using.
     
  18. JoakimOlsson

    JoakimOlsson

    Joined:
    May 20, 2019
    Posts:
    11
    @BestHTTP No, I am afraid that is not possible. Do not really have access to the server code.
     
  19. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @JoakimOlsson

    Thanks. I'm going to try to recreate this issue.
     
  20. ChewyMicha

    ChewyMicha

    Joined:
    Jul 2, 2018
    Posts:
    4
    ok we made a small app to test the network speed. In the unity editor we get like 70MB/s, but on the new iPad Pro we only get like 10 MB/s. If you compare that speed to some online speedtests, these results are kind of confusing.
    Do you have any ideas why the download speed on mobile is THAT much worse then in the editor?
     
  21. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    997
    Alternative suggestions:
    1. There are a number of open source implementations of simple HTTP servers in C#. Here is one: https://www.codeproject.com/Articles/5205722/Tiny-Web-Server-Take-2 (Caveat: I found this with a quick web search and have not evaluated the quality of the code.)
    2. Before you embed a web server in your Unity app or game, consider carefully the implications on security and user support, and whether or not you really want to go that route. Specifically:
      • Having a web server on a client device implies a listening socket (typically on TCP port 80 for HTTP or 443 for HTTPS). You will need for the user to be willing and able to open a firewall port to allow inbound connections, and even if they do, this has obvious security ramifications for the device.
      • Peer connections on a wired LAN are generally simple if you either (1) know the IP address of the peer-to-peer server, or (2) can implement some sort of service advertisement protocol. Peer connections on a wireless network depend partly on the settings of the access point; not all of them allow direct client-to-client connections. Residential customers may not know how to configure this setting in their router, and some routers may not allow it at all. Users will have no control over wifi in public hotspots, hotels, etc.
    3. Best HTTP/2 supports WebSockets, so you may be able to simply rethink what you mean by "server". Use a simple relay server in the cloud, possibly built on a field-proven toolkit such as Node.js, to handle the setup of your WebSocket connections to the two nodes and to blindly (or mostly so) relay traffic after setup.
      • The remote server only has to function as such during the initial connection and handshaking. After that, which end sends requests and which end responds to them is up to your application logic. The remote server just passes data between what it views as two clients, and you decide which of those endpoints does what.
      • This gets around all the firewall and listening socket issues on the client, and it avoids the wireless access point peer connection restriction. As a side benefit, although of course there is a hit in raw performance, you get the ability to decouple players from each other geographically.
      • The IP addresses of the clients are now irrelevant to one another, and users don't have to get down to that level of detail about their devices.
    4. If you really must have peer to peer, can you implement a simple web server on the laptop instead of on the mobile device, but then use the preceding suggestion (WebSocket) to invert your conceptual roles of the two devices after the initial handshake?
    All of the above assumes that you have already decided not to use one of the third-party game hosting options that exist in the Unity ecosystem (there are good and valid reasons for not wanting to do so, of course). You could consider a hybrid solution where one of these systems provides matchmaking and account management, but after clients initially connect to those services, the communication is handed off to your own WebSocket (or similar) implementation.

    My general recommendation is to review the transaction requirements of your app and decide if there is another way to achieve those. A web server on the mobile device, although technically possible, is a perilous path.
     
    BestHTTP likes this.
  22. b43-14brett647

    b43-14brett647

    Joined:
    Sep 9, 2015
    Posts:
    10
    I am getting errors when I try to download a text file from a google cloud storage public bucket.

    Code (CSharp):
    1. new HTTPRequest(new Uri("https://storage.googleapis.com/test-game-bucket/data.txt"), (request, response) =>
    2. {
    3. Debug.Log(response.DataAsText);
    4. }).Send();
    Error messages:

    [637094608906424810] Err [HTTP2Stream]: [1] RST Stream frame ([HTTP2RST_StreamFrame Header: [HTTP2FrameHeaderAndPayload Length: 4, Type: RST_STREAM, Flags: 00000000, StreamId: 1, PayloadOffset: 0, DontUseMemPool: False], Error: PROTOCOL_ERROR(1)]) received in state HalfClosedLocal!
    UnityEngine.Debug:LogError(Object)
    BestHTTP.Logger.DefaultLogger:Error(String, String) (at Assets/Best HTTP/Source/Logger/DefaultLogger.cs:76)
    BestHTTP.Connections.HTTP2.HTTP2Stream:processIncomingFrames(List`1) (at Assets/Best HTTP/Source/Connections/HTTP2/HTTP2Stream.cs:344)
    BestHTTP.Connections.HTTP2.HTTP2Stream:AddFrame(HTTP2FrameHeaderAndPayload, List`1) (at Assets/Best HTTP/Source/Connections/HTTP2/HTTP2Stream.cs:182)
    BestHTTP.Connections.HTTP2.HTTP2Handler:RunHandler() (at Assets/Best HTTP/Source/Connections/HTTP2/HTTP2Handler.cs:168)
    BestHTTP.Connections.HTTPConnection:ThreadFunc() (at Assets/Best HTTP/Source/Connections/HTTPConnection.cs:117)
    BestHTTP.PlatformSupport.Threading.<>c__DisplayClass4_0:<RunLongLiving>b__0() (at Assets/Best HTTP/Source/PlatformSupport/Threading/ThreadedRunner.cs:79)
    System.Threading.ThreadHelper:ThreadStart(Object)



    [637094608907172380] Ex [RequestEventHelper]: HandleRequestStateChange Error - Message: 1: Object reference not set to an instance of an object at SocketIO+<>c.<DownloadIPFile>b__2_0 (BestHTTP.HTTPRequest request, BestHTTP.HTTPResponse response) [0x00001] in ./Assets/Internet/SocketIO/SocketIO.cs:20
    at BestHTTP.Core.RequestEventHelper.HandleRequestStateChange (BestHTTP.Core.RequestEventInfo event) [0x00079] in ./Assets/Best HTTP/Source/Core/RequestEvents.cs:268 StackTrace: at SocketIO+<>c.<DownloadIPFile>b__2_0 (BestHTTP.HTTPRequest request, BestHTTP.HTTPResponse response) [0x00001] in ./Assets/Internet/SocketIO/SocketIO.cs:20
    at BestHTTP.Core.RequestEventHelper.HandleRequestStateChange (BestHTTP.Core.RequestEventInfo event) [0x00079] in ./Assets/Best HTTP/Source/Core/RequestEvents.cs:268
    UnityEngine.Debug:LogError(Object)
    BestHTTP.Logger.DefaultLogger:Exception(String, String, Exception) (at Assets/Best HTTP/Source/Logger/DefaultLogger.cs:111)
    BestHTTP.Core.RequestEventHelper:HandleRequestStateChange(RequestEventInfo) (at Assets/Best HTTP/Source/Core/RequestEvents.cs:272)
    BestHTTP.Core.RequestEventHelper:processQueue() (at Assets/Best HTTP/Source/Core/RequestEvents.cs:220)
    BestHTTP.HTTPManager:OnUpdate() (at Assets/Best HTTP/Source/HTTPManager.cs:354)
    BestHTTP.HTTPUpdateDelegator:Update() (at Assets/Best HTTP/Source/HTTPUpdateDelegator.cs:165)
     
    Last edited: Nov 16, 2019 at 8:37 AM
  23. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
  24. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    syscrusher likes this.
  25. b43-14brett647

    b43-14brett647

    Joined:
    Sep 9, 2015
    Posts:
    10
    This does appear to have fixed it. I will test it more tomorrow. Thanks!
     
    syscrusher likes this.
  26. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,441
    Is there more examples in this updated paid upgrade package?
     
  27. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @Player7

    I think it has less overall, as i removed the old Socket.IO and SignalR samples that has no working server to support the sample.

    Do you have any specific topic you are interested in for more samples?
     
  28. jpsilvashy

    jpsilvashy

    Joined:
    Jun 24, 2019
    Posts:
    3
    Hi the Socket.io example in the docs does not serialize a json object, and it seems it fails to do so when I send json as a string, per the example in the docs, if I send a json object it should get serialized, but its always an empty object even tho toString() proves its valid json:


    Code (CSharp):
    1. void OnPlayerLocalUpdate(Socket socket, Packet packet, params object[] args)
    2. {
    3.     var serialized = JsonUtility.ToJson(args[0]);
    4. }
    5.  
     
  29. IVPathfinder

    IVPathfinder

    Joined:
    Feb 13, 2017
    Posts:
    4
    Thank you for the quick response to the issue on github the other day pertaining to socket io example code errors.

    Issue Info
    I'm having issues with BestHttp2:
    "Remote server closed the connection before sending response header! Previous request state: Processing. Connection state ProcessingError"

    Env Info
    Unity 2018.4.11f11, Mac & Windows Editor, Localhost - Sub 1ms Server Response. Both server & client process running both BestHttp socket.io & BestHttp Http1.1 (NodeJs Express server http - 172.*.*.* docker nginx https proxy)
    Fresh install of BestHttp in an existing project undergoing networking upgrade.
    We execute BestHttp requests & callbacks on a General purpose Task Execution & Callback handler Thread, but after examining some of your core code it seems you do the same?

    Reproducibility & Remarks
    It's quite hard to reproduce this, but when it does happen, it happens really frequently - seems this issue is timing correlated with best reproducibility using ~1-300ms responses involving database calls.
    I can personally get permission to provide some wireshark logs, would love to work with you 1 on 1.



    Closing
    I've just noticed you've released V 2.0.1 that seems to deal with this issue, can I get a copy asap? It is not on the asset store yet.
    We would love to use BestHttp in our production environment, due to great reviews, here's to hoping we'll solve this issue! Thanks
     
  30. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    997
    Turned around a private patch in about 90 minutes? That's what I call support! :D

    (EDITED: I had looked at the timestamp from the wrong post, the first time, so I had the time as 10 minutes. 90 minutes is still outstanding.)
     
    Last edited: Nov 17, 2019 at 7:56 PM
  31. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @jpsilvashy

    Could you show how you send it on server side?
     
  32. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
  33. jpsilvashy

    jpsilvashy

    Joined:
    Jun 24, 2019
    Posts:
    3
    Sure! On the server I'm not using the basic send/"message" channel but sending to a named channel the client is subscribed with, like this:

    Code (JavaScript):
    1. socket.emit('playerLocalJoin', {foo: "bar"});
    In my Unity app, im subscribing to the event like this in a connect function:

    Code (CSharp):
    1. // ...
    2. manager.Socket.On("playerLocalJoin", OnPlayerLocalJoin);
    3. // ...
    And also last to mention the object to serialize into would be something simple like this:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. [System.Serializable]
    4. public class PlayerInfo
    5. {
    6.   public string foo;
    7.  
    8.   public static PlayerInfo CreateFromJSON(string jsonString)
    9.   {
    10.    return JsonUtility.FromJson<PlayerInfo>(jsonString);
    11.   }
    12. }
     
  34. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @syscrusher

    While i try my best, you might checked the wrong times. b43-14brett647 reported a bug 9:31 AM and i sent the patch at 11:01 AM. (I guess these are times adjusted to my locale.) So it wasn't that great. :)

    I had a PC upgrade recently and had to download wireshark too. While i love Charles Proxy, to debug HTTP/2 wireshark is a must. But beccause HTTP/2 is done over TLS, i had to add the NSS Key Log Format support too to the plugin so i can debug it effortlessly. This bugreport was a great reminder to extend the plugin's HTTPS documentation.
     
    syscrusher likes this.
  35. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @jpsilvashy

    In your OnPlayerLocalJoin the args parameter is an already deserialized object. For objects like { foo: "bar" }, by default the plugin creates a Dictionary<string, object>. So you could write something like this:
    Code (CSharp):
    1. void OnPlayerLocalJoin(Socket socket, Packet packet, params object[] args)
    2. {
    3.     var obj = args[0] as Dictionary<string, object>;
    4.  
    5.     string foo = obj["foo"].ToString();
    6.  
    7.     Debug.Log(foo);
    8. }
     
  36. b43-14brett647

    b43-14brett647

    Joined:
    Sep 9, 2015
    Posts:
    10
    Is there a way to add query strings to a request?

    Adding "?q=3" to the end of the url works, but is there a way to add a query to a HTTPRequest object in code?
     
  37. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,441
    Would think there would be examples for most the featured stuff no? Signalr stuff ..don't really follow the webgl stuff currently but what works with that seeing as it used to be problem platform for doing anything..including network stuff.. probably still is I guess?
     
  38. jpsilvashy

    jpsilvashy

    Joined:
    Jun 24, 2019
    Posts:
    3
    Thank you, that worked great!
     
  39. IVPathfinder

    IVPathfinder

    Joined:
    Feb 13, 2017
    Posts:
    4
    Update
    Just tried your fix V2.0.1
    Hey there, seems like the problem is still occurring. I've turned on ~~Logging = ALL

    "Remote server closed connection before receiving response header.."



    Event, statechange, state close, Protocol Support Unknown?

    Here's another log:



    I've tried setting up the macbook with localhost wireshark, but to to avail.

    Do you have capture filter string example for localhost that i could use? (Http, socket.io)

    Looking forward to your response, Thanks.
     
    Last edited: Nov 18, 2019 at 4:44 AM
  40. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @b43-14brett647

    No, there's no other way. The plugin doesn't touch the request's url.
     
  41. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @Player7

    Writing samples for every feature might would be a larger task than writing the plugin itself. But as the documentation got its new place it's easier to add new text and code samples. The two should complement each others.

    SignalR, while Microsoft keeps it supported, it's clearly not the future that they invest in. I keep it supported, and a lot of features that i added (HTTP/2, memory pooling,) can improve indirectly the SignalR client too. But as Microsoft, i don't have the luxury either to keep a server for SignalR samples, let alone write more.

    WebGL is a great platform where i can show off. Interested maybe-future-customers can check out the plugin in working conditions. Although WebGL has its limitations and not all features works under it.

    While i'm not against adding new samples, i consider the samples+documentation as a whole.
     
    syscrusher likes this.
  42. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @IVPathfinder

    The first thing the plugin tries to read for a response is its status line. In these cases the plugin could read anything:
    upload_2019-11-18_14-41-49.png
    Reading the status line resulted in an empty string.

    Wireshark should support capture the localhost if you select the following connection:
    upload_2019-11-18_14-49-42.png
     
  43. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,441
    Wasn't aware.. I don't really follow it but I would like to do something server based using .net core3.0 and whatever the latest future supported tech is for networking c#.. thought that was SignalR...if that isn't ..what it the future supported stuff?

    And is it supported on the webgl client.. as I'd rather do something server side that would work client on unity for all the platforms.

    "WebGL is a great platform where i can show off. Interested maybe-future-customers can check out the plugin in working conditions. Although WebGL has its limitations and not all features works under it."

    Any information as to what that stuff is and what is likely to be supported in the future? don't mind starting something that webgl doesn't support now if it is likely to be supported in a year?
     
  44. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @Player7

    Well, i might be alone with it, but Microsoft did a bad name chose for their next protocol.
    They had SignalR and created an entirely new one protocol that doesn't compatible with the old one and named it SignalR Core. The old SignalR receives no more feture updates, while the new SignalR Core is the new faworite by MS and under active development.
    What you saw is my samples for SignalR Core, and i would recommend to use it.
     
    syscrusher likes this.
  45. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,441
    Oh ok. so SignalR Core is the one to use then and that works on webgl aswel right?
     
  46. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @Player7

    Yes, exactly.

    (The old SignalR still works and my implementation supports WebGL too, but i recommend to use the new one.)
     
    Cromfeli likes this.
  47. b43-14brett647

    b43-14brett647

    Joined:
    Sep 9, 2015
    Posts:
    10
    I'm getting a bug when calling Google Cloud Functions over HTTPS.
    Note: I am using the version of BestHTTP that you sent me over private message a little while ago.

    Code 1:
    Code (CSharp):
    1. string GoogleCloudFunctionHTTP = "http://<project>.cloudfunctions.net/Test1";
    2. string GoogleCloudFunctionHTTPS = "https://<project>.cloudfunctions.net/Test1";
    3.  
    4. HTTPRequest request = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request1Response);
    5.         request.Send();
    6.    
    7. HTTPRequest request2 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request2Response);
    8.         request2.Send();
    9.    
    10. HTTPRequest request3 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request3Response);
    11.         request3.Send();
    12.  
    Result:
    Response 1 finishes. Responses 2 and 3 never show up.


    Code 2:
    Code (CSharp):
    1. HTTPRequest request = new HTTPRequest(new Uri(GoogleCloudFunctionHTTP), Request1Response);
    2.         request.Send();
    3.    
    4. HTTPRequest request2 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request2Response);
    5.         request2.Send();
    6.    
    7. HTTPRequest request3 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request3Response);
    8.         request3.Send();
    Result:
    Response 1 and 2 finish. Response 3 has an error.


    Code 3:
    Code (CSharp):
    1. HTTPRequest request = new HTTPRequest(new Uri(GoogleCloudFunctionHTTP), Request1Response);
    2.         request.Send();
    3.    
    4. HTTPRequest request2 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTP), Request2Response);
    5.         request2.Send();
    6.    
    7. HTTPRequest request3 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request3Response);
    8.         request3.Send();
    Result:
    Response 1, 2 and 3 finish.


    Code 4:
    Code (CSharp):
    1. HTTPRequest request = new HTTPRequest(new Uri(GoogleCloudFunctionHTTP), Request1Response);
    2.         request.Send();
    3.    
    4. HTTPRequest request2 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTP), Request2Response);
    5.         request2.Send();
    6.    
    7. HTTPRequest request3 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTP), Request3Response);
    8.         request3.Send();
    Result:
    Response 1, 2 and 3 finish.
     
    Last edited: Nov 21, 2019 at 10:58 AM
  48. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,375
    @b43-14brett647

    Sent a new link in private, google cloud doesn't seem to like http/2 ping messages...

    So, now you can set ping frequency through the regular HTTP2Settings:
    Code (CSharp):
    1. BestHTTP.HTTPManager.HTTP2Settings.MaxIdleTime = TimeSpan.FromMinutes(15);
    2. BestHTTP.HTTPManager.HTTP2Settings.PingFrequency = TimeSpan.FromMinutes(5);
     
    syscrusher likes this.
  49. b43-14brett647

    b43-14brett647

    Joined:
    Sep 9, 2015
    Posts:
    10
    I will test it out, along with the ping frequency in the morning when I get the chance. Thanks!
     
  50. b43-14brett647

    b43-14brett647

    Joined:
    Sep 9, 2015
    Posts:
    10
    This did not fix the bug. I tried the new package you sent me and the bug is still happening.

    Code:
    Code (CSharp):
    1. BestHTTP.HTTPManager.HTTP2Settings.MaxIdleTime = TimeSpan.FromMinutes(15);
    2. BestHTTP.HTTPManager.HTTP2Settings.PingFrequency = TimeSpan.FromMinutes(5);
    3.  
    4. HTTPRequest request = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request1Response);
    5.  request.Send();
    6.  
    7. HTTPRequest request2 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request2Response);
    8. request2.Send();
    9.  
    10. HTTPRequest request3 = new HTTPRequest(new Uri(GoogleCloudFunctionHTTPS), Request3Response);
    11. request3.Send();
    Result:
    Response 1 finishes which is a small improvement. But responses 2 and 3 never show up.


    Thanks for working on fixing it
     
    Last edited: Nov 22, 2019 at 2:32 AM