Search Unity

Best HTTP Released

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

  1. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @sofianehamza

    There are no PlayMaker actions in the package, but relatively easy to write one.
     
  2. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    76
    Okay, then we'll keep doing it like this.

    Hmm, I believe there's no other asset using those, but we're having another issue when building with another plugin (totally unrelated to this). Maybe when we upgraded the project from 5.6 to 2018.. something broke? :/
     
  3. JPFerreiraVB

    JPFerreiraVB

    Joined:
    Sep 18, 2017
    Posts:
    35
    Hi Best HTTP.
    I have a question before i purchase this plugin.
    Am i able to create a Websocket connection, and parse a Buffer array from a NodeJs?
    I'm having trouble doing this using another plugin. Just wanted to be shure before i buy.

    Thank you in advanced.
     
  4. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @JPFerreiraVB

    The plugin can send and receive both textual and binary data. Both type of data are sent to the callbacks without any modifications, you will receive it as the server sent it.
     
  5. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    54
    Hi, I"m trying to confirm I'm receiving gzipped responses from my server and compare the file size, is there a way to save the response to file before it is unzipped? Any other way to make sure the content is gzipped?
     
  6. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    953
    @BestHTTP

    I'm getting following warnings, please advise


    Assets/Best HTTP (Pro)/BestHTTP/SecureProtocol/crypto/AsymmetricCipherKeyPair.cs(39,16): warning CS0436: The type 'AsymmetricKeyParameter' in 'Assets/Best HTTP (Pro)/BestHTTP/SecureProtocol/crypto/AsymmetricKeyParameter.cs' conflicts with the imported type 'AsymmetricKeyParameter' in 'BouncyCastle_GameSparks, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942'. Using the type defined in 'Assets/Best HTTP (Pro)/BestHTTP/SecureProtocol/crypto/AsymmetricKeyParameter.cs'.
     
  7. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @Numa

    The plugin will keep the Content-Encoding header even after decompressed the content, so you will know whether it was gzipped or not. There's no way though to skip decompression.
    Alternately you can use Charles proxy to route the requests through, it can display the compressed content where you can get length information too:
    upload_2018-12-9_18-51-25.png
     
  8. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @AmRafay1

    My best bet is that there's another plugin that uses and bundles the Bouncy Castle library (BouncyCastle_GameSparks).
    You can disable the alternate SSL/TLS handler completely by adding the BESTHTTP_DISABLE_ALTERNATE_SSL symbol to your Scripting Define Symbols.
     
    jGate99 likes this.
  9. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    54
    Thanks!
     
  10. emre_CC

    emre_CC

    Joined:
    Jul 27, 2018
    Posts:
    3
    Hi There,

    I recently bought your project. And I am using socket.io sending and receiving messages. One of the message that I am receiving is a json array and I can able to extract the value if the json array has only one array but if the json is nested array I was not able to reach the value.

    Using the below code I can receive the value of the volatile from another json but sender(server) is the same.

    Dictionary<string, object> obj = args[0] as Dictionary<string,object>;
    Debug.Log(obj["volatile"]);

    however, the message that I am receiving is nested Json array which is this;
    Note: Objects are Json arrays.
    { navigation:
    { isSearchResult: true,
    lists: [
    { type: 'title',
    title: 'Tracks',
    availableListViews: [ 'list' ],
    items:
    [ [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object] ] } ]
    ] } }

    So what I wanna get is something like : obj["navigation"]["lists"]["items"] to get the third iteration of value and also the lenght of the array(as you can see there are 20 objects inside items' array) e.g obj["navigation"][lists][items].length . How can I do that?

    Thanks for the answer in advance.
    Best,
    Emre
     
    Last edited: Dec 12, 2018
  11. emre_CC

    emre_CC

    Joined:
    Jul 27, 2018
    Posts:
    3
    Hi guys,
    I figured out the solution after some deep research on the internet:

    Using the multiple arrays, I used Newtonsoft.Json.Linq; so it provide me to use multiple brackets to reach the deeper tree in Json like the code below;
    Dictionary<string, object> obj = args[0] as Dictionary<string,object>;
    var obj1 = Encode(obj); // Encoded to get the string and than parsed to use Newtonsoft Json library.
    var jObject = JObject.Parse(obj1); // Parsed
    jObject["navigation"]["lists"]["items"] than I can use it and get the value!

    For the length:
    ((JArray)jObject["navigation"]["lists"]["items"]).Count will give the number of array inside.

    Note: if anyone wonder how I encode it :
    using LitJson;

    public string Encode(Dictionary<string, object> obj) { JsonWriter writer = new JsonWriter(); JsonMapper.ToJson(obj, writer); return writer.ToString(); }

    If any shorter solution are welcome! But this is my solution hope it can help others.
     
    Cromfeli likes this.
  12. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @emre_CC

    You can use the package's JsonDotNetEncoder class located in the the \Best HTTP (Pro)\Examples\SocketIO\SocketIO Json Encoders\JsonDotNetEncoder.cs. You have to remove the comment out symbols: /* and */:
    Code (CSharp):
    1. #if !BESTHTTP_DISABLE_SOCKETIO
    2.  
    3. using System;
    4. using System.Collections.Generic;
    5.  
    6. namespace BestHTTP.SocketIO.JsonEncoders
    7. {
    8.     using Newtonsoft.Json;
    9.  
    10.     /// <summary>
    11.     /// This class uses Newtonsoft's Json encoder (JSON .NET For Unity - http://u3d.as/5q2).
    12.     /// </summary>
    13.     public sealed class JsonDotNetEncoder : IJsonEncoder
    14.     {
    15.         public List<object> Decode(string json)
    16.         {
    17.             return JsonConvert.DeserializeObject<List<object>>(json);
    18.         }
    19.  
    20.         public string Encode(List<object> obj)
    21.         {
    22.             return JsonConvert.SerializeObject(obj);
    23.         }
    24.     }
    25. }
    26.  
    27. #endif
    Then, you can use this encoder for your Socket.IO SocketManager:
    Code (CSharp):
    1. Manager = new SocketManager(new Uri("https://myserver/socket.io/"), options);
    2. Manager.Encoder = new BestHTTP.SocketIO.JsonEncoders.JsonDotNetEncoder();
    This way, arguments for your callbacks will be JObjects:
    Code (CSharp):
    1. JObject jObject = args[0] as JObject;
     
  13. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @emre_CC

    Or you can write a helper function similar to your 'Encode' one, but it would return a strongly typed object.
    Something like this:
    Code (CSharp):
    1. class ListElement
    2. {
    3.     public string type;
    4.     public string title;
    5.     public List<string> availableListViews;
    6.     public List<object> items;
    7. }
    8.  
    9. class Navigation
    10. {
    11.     public bool isSearchResult;
    12.     public List<ListElement> lists;
    13. }
    14.  
    15. class SocketIOResult
    16. {
    17.     public Navigation navigation;
    18. }
    19.  
    20. static T ConvertTo<T>(object obj)
    21. {
    22.     var writer = new LitJson.JsonWriter();
    23.     LitJson.JsonMapper.ToJson(obj, writer);
    24.  
    25.     return LitJson.JsonMapper.ToObject<T>(new LitJson.JsonReader(writer.ToString()));
    26. }
    27.  
    28. private void OnResult(Socket socket, Packet packet, object[] args)
    29. {
    30.     SocketIOResult result = ConvertTo<SocketIOResult>(args[0]);
    31.  
    32.     Debug.Log(result.navigation.lists[0].items.Count);
    33. }
     
    Cromfeli likes this.
  14. TriPawCat

    TriPawCat

    Joined:
    Nov 23, 2015
    Posts:
    8
    I got some NullReferenceException and IOException with only one stack trace:
    Exception stack trace: at Org.BouncyCastle.Math.EC.Endo.GlvTypeBEndomorphism.get_PointMap () [0x00000] in <filename unknown>:0
    only BestHTTP using the GlvTypeBEndomorphism in my game. It happens when game back to the foreground and do the reconnection.
     
  15. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @TriPawCat

    What protocol are you used when you received this exception?
     
    Last edited: Jan 4, 2019
  16. szymongame90

    szymongame90

    Joined:
    Jan 4, 2019
    Posts:
    1
    Hi @BestHTTP
    Can I use your plugin to add the game rooms support in my project? If so, how can I achieve that using socket.io? Could someone give me some hints about creating a sample project that would utilize "rooms" and socket.io?
     
  17. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
  18. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    49
    Awesome work on the SignalR Core features!
     
    Cromfeli and BestHTTP like this.
  19. AG_Dan

    AG_Dan

    Joined:
    Jul 31, 2017
    Posts:
    6
    I recently discovered that BestHTTP's implementation of the SignalR Core client does not fully handle the connection negotiation protocol. In particular, it does not handle redirects which are a required feature in order to use Azure's new SignalR Service. Attached is the diff of the change I implemented to fix this.
     

    Attached Files:

    • fix.txt
      File size:
      8.8 KB
      Views:
      304
  20. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @AG_Dan

    Yes, it's absolutely true. I'm doing the finishing touches on the next version of the plugin where i fixed these issues.
     
  21. mittalnupur

    mittalnupur

    Joined:
    Jun 7, 2018
    Posts:
    2
    Connection timed out error on unity editor for websocket . working fine with sample mentioned
     
  22. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @mittalnupur

    Can you send the url you are trying to connect to in private or in mail?
     
  23. mittalnupur

    mittalnupur

    Joined:
    Jun 7, 2018
    Posts:
    2
  24. Algok

    Algok

    Joined:
    Mar 3, 2017
    Posts:
    3
    I had a problem with caching. There were situations when the string HTTPCacheService.SetHeaders (CurrentRequest); in HTTPConnection executed several times. Therefore, in the outgoing request, the If-None-Match and If-Modified-Since headers were duplicated.
     
  25. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @Algok

    It seems that it can happen indeed. Will be fixed in the next release.
     
  26. nrorn

    nrorn

    Joined:
    Sep 23, 2016
    Posts:
    5
    Hi,
    we are migrating a running iOS app, which uses BestHttp , to Unity 2018.3 and .Net 4.0

    Problem: some HttpRequests (not all) now timeout and fail. We've done a clean re-install of BestHttp 1.11.0, but the issue persists. Below is the Xcode console log when the app freezes, and before going into timeout (more context in attachment)

    2019-01-21 17:48:40.937662-0500 coreApp[4903:1375329] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C2.1:2][0x11ba910b0] get output frames failed, state 8196
    2019-01-21 17:48:40.937864-0500 coreApp[4903:1375329] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C2.1:2][0x11ba910b0] get output frames failed, state 8196
    2019-01-21 17:48:40.938110-0500 coreApp[4903:1375329] TIC Read Status [2:0x0]: 1:57
    2019-01-21 17:48:40.938124-0500 coreApp[4903:1375329] TIC Read Status [2:0x0]: 1:57[/code]

    Any thought on what might be causing the timeout?
    Thanks,
     

    Attached Files:

  27. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @nrorn

    Are you setting the AlternateSSL value to false globally(HTTPManager.UseAlternateSSLDefaultValue) or per-request:
    Code (CSharp):
    1. HTTPRequest request = new HTTPRequest(uri, (req, resp) => { });
    2.  
    3. request.UseAlternateSSL = false;
    4.  
    5. request.Send();
    ?

    If no, than i don't know what those lines could be, because the plugin uses the bundled BouncyCastle for HTTPS by default.
     
  28. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    953
  29. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @jGate99

    No, at least last time I checked Unity's public c# api doesn't allow texture generation from a thread other than its main thread.
     
    jGate99 likes this.
  30. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    953
    they now have

    This method attaches a DownloadHandlerTexture object to the UnityWebRequest. DownloadHandlerTexture is a specialized DownloadHandler which is optimized for storing images which are to be used as textures in the Unity Engine. Using this class significantly reduces memory reallocation compared to downloading raw bytes and creating a texture manually in script. In addition, texture conversion will be performed on a worker thread.
     
  31. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @jGate99

    DownloadHandlerTexture is bound to UnityWebRequest, the plugin just can't use it. And if you can't use DownloadHandlerTexture, you can't create a Texture2D on a non-unity thread. If you try to do so, Texture2D's LoadImage throws an exception:
     
  32. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @jGate99

    If you take a look on the Unity's reference source, they call an InternalGetTextureNative function:
    Code (CSharp):
    1.         private Texture2D InternalGetTexture()
    2.         {
    3.             if (mHasTexture)
    4.             {
    5.                 if (mTexture == null)
    6.                 {
    7.                     // this is corner case when this DH survives scene reload, while texture does not
    8.                     mTexture = new Texture2D(2, 2);
    9.                     mTexture.LoadImage(GetData(), mNonReadable);
    10.                 }
    11.             }
    12.             else if (mTexture == null)
    13.             {
    14.                 mTexture = InternalGetTextureNative();
    15.                 mHasTexture = true;
    16.             }
    17.  
    18.             return mTexture;
    19.         }
    20.  
    21.         [NativeThrows]
    22.         private extern Texture2D InternalGetTextureNative();
     
    jGate99 likes this.
  33. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    953
    Thanks for looking into it, hope unity makes this internal thread expose for plugins like besthttp.
     
  34. TriPawCat

    TriPawCat

    Joined:
    Nov 23, 2015
    Posts:
    8
    I used tcp, with WebSocket.
     
  35. ncortesp

    ncortesp

    Joined:
    Oct 28, 2016
    Posts:
    34
    Hi BestHttp,

    I'm trying to build a WebGL version for Facebook Web Games and I'm having troubles with some browsers because of the SignalR.

    Note: Chrome works like a charm.

    I'll attach you the errors I'm seeing.

    =====================
    FIREFOX
    =====================

    Console:
    Err [NegotiationData]: Negotiation request failed with error: Unknown Error! Maybe a CORS porblem?
    Err [SignalR Connection]: Unknown Error! Maybe a CORS porblem?

    JavaScript Popup:
    An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
    uncaught exception: abort(130) at jsStackTrace (FB_WebGL.asm.framework.unityweb:1156:12)
    stackTrace (FB_WebGL.asm.framework.unityweb:1170:11)
    abort (FB_WebGL.asm.framework.unityweb:22493:43)
    nullFunc_vii (FB_WebGL.asm.framework.unityweb:16132:2)
    b130 (FB_WebGL.asm.code.unityweb:4383337:2)
    _TransportBase_Reconnect_m4267982990 (FB_WebGL.asm.code.unityweb:3274557:51)
    _Connection_Reconnect_m3314547329 (FB_WebGL.asm.code.unityweb:2193889:3)
    _SignalRManager_U3CSubscribeEventsU3Em__0_m3112581173 (FB_WebGL.asm.code.unityweb:4229870:2)
    _OnErrorDelegate_Invoke_m1467055630 (FB_WebGL.asm.code.unityweb:1397212:35)
    _Connection_BestHTTP_SignalR_IConnection_Error_m1816573184 (FB_WebGL.asm.code.unityweb:2678903:15)
    __ZN23InterfaceActionInvoker1IP8String_tE6InvokeEjP11Il2CppClassP12Il2CppObjectS1_ (FB_WebGL.asm.code.unityweb:3404781:46)
    _Connection_OnNegotiationError_m4182110249 (FB_WebGL.asm.code.unityweb:3940798:2)
    _Action_2_Invoke_m3596261411_gshared (FB_WebGL.asm.code.unityweb:1431625:35)
    _NegotiationData_RaiseOnError_m4097404389 (FB_WebGL.asm.code.unityweb:3389597:3)
    _NegotiationData_OnNegotiationRequestFinished_m2803805793 (FB_WebGL.asm.code.unityweb:1863291:4)
    _OnRequestFinishedDelegate_Invoke_m3371029612 (FB_WebGL.asm.code.unityweb:1356068:35)
    dynCall_viiii (FB_WebGL.asm.code.unityweb:4240957:33)
    invoke_viiii (FB_WebGL.asm.framework.unityweb:17734:3)
    _HTTPRequest_CallCallback_m2640281423 (FB_WebGL.asm.code.unityweb:2682004:3)
    dynCall_vii (FB_WebGL.asm.code.unityweb:4332038:32)
    invoke_vii (FB_WebGL.asm.framework.unityweb:17806:3)
    _ConnectionBase_HandleCallback_m3535074261 (FB_WebGL.asm.code.unityweb:2121596:4)
    dynCall_vii (FB_WebGL.asm.code.unityweb:4332038:32)
    invoke_vii (FB_WebGL.asm.framework.unityweb:17806:3)
    _HTTPManager_OnUpdate_m2252696592 (FB_WebGL.asm.code.unityweb:121576:7)
    _HTTPUpdateDelegator_Update_m2271029028 (FB_WebGL.asm.code.unityweb:2965065:3)
    __Z31RuntimeInvoker_Void_t1185182177PFvvEPK10MethodInfoPvPS4_ (FB_WebGL.asm.code.unityweb:4220307:32)
    dynCall_iiiii (FB_WebGL.asm.code.unityweb:4224385:41)
    invoke_iiiii (FB_WebGL.asm.framework.unityweb:17166:10)
    __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException (FB_WebGL.asm.code.unityweb:3461044:8)
    _il2cpp_runtime_invoke (FB_WebGL.asm.code.unityweb:3998100:9)
    __Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb (FB_WebGL.asm.code.unityweb:3688834:8)
    __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb (FB_WebGL.asm.code.unityweb:2619947:7)
    __ZN13MonoBehaviour16CallUpdateMethodEi (FB_WebGL.asm.code.unityweb:2315010:4)
    __ZN13MonoBehaviour6UpdateEv (FB_WebGL.asm.code.unityweb:4347612:2)
    __ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv (FB_WebGL.asm.code.unityweb:1937676:71)
    __ZN16BehaviourManager6UpdateEv (FB_WebGL.asm.code.unityweb:3664729:2)
    __ZZ23InitPlayerLoopCallbacksvEN41UpdateScriptRunBehaviourUpdateRegistrator7ForwardEv (FB_WebGL.asm.code.unityweb:3500605:67)
    __Z17ExecutePlayerLoopP22NativePlayerLoopSystem (FB_WebGL.asm.code.unityweb:2422718:41)
    __Z17ExecutePlayerLoopP22NativePlayerLoopSystem (FB_WebGL.asm.code.unityweb:2422689:7)
    __Z10PlayerLoopv (FB_WebGL.asm.code.unityweb:2623653:2)
    __ZL8MainLoopv (FB_WebGL.asm.code.unityweb:2268828:3)
    dynCall_v (FB_WebGL.asm.code.unityweb:4383486:29)
    browserIterationFunc (FB_WebGL.asm.framework.unityweb:2791:4)
    runIter (FB_WebGL.asm.framework.unityweb:2893:5)
    Browser_mainLoop_runner (FB_WebGL.asm.framework.unityweb:2829:3)

    =====================
    SAFARI
    =====================

    JavaScript Popup:
    An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
    abort(130) at jsStackTrace (FB_WebGL.asm.framework.unityweb:1156:21)
    stackTrace (FB_WebGL.asm.framework.unityweb:1170:23)
    abort (FB_WebGL.asm.framework.unityweb:22493:53)
    nullFunc_vii (FB_WebGL.asm.framework.unityweb:16132:7)
    b130 (FB_WebGL.asm.code.unityweb:4383337:14)
    _TransportBase_Reconnect_m4267982990 (FB_WebGL.asm.code.unityweb:3274557:51)
    _Connection_Reconnect_m3314547329 (FB_WebGL.asm.code.unityweb:2193889:39)
    _SignalRManager_U3CSubscribeEventsU3Em__0_m3112581173 (FB_WebGL.asm.code.unityweb:4229870:35)
    _OnErrorDelegate_Invoke_m1467055630 (FB_WebGL.asm.code.unityweb:1397212:35)
    _Connection_BestHTTP_SignalR_IConnection_Error_m1816573184 (FB_WebGL.asm.code.unityweb:2678903:50)
    __ZN23InterfaceActionInvoker1IP8String_tE6InvokeEjP11Il2CppClassP12Il2CppObjectS1_ (FB_WebGL.asm.code.unityweb:3404781:46)
    _Connection_OnNegotiationError_m4182110249 (FB_WebGL.asm.code.unityweb:3940798:84)
    _Action_2_Invoke_m3596261411_gshared (FB_WebGL.asm.code.unityweb:1431625:35)
    _NegotiationData_RaiseOnError_m4097404389 (FB_WebGL.asm.code.unityweb:3389597:39)
    _NegotiationData_OnNegotiationRequestFinished_m2803805793 (FB_WebGL.asm.code.unityweb:1863291:45)
    _OnRequestFinishedDelegate_Invoke_m3371029612 (FB_WebGL.asm.code.unityweb:1356068:35)
    dynCall_viiii (FB_WebGL.asm.code.unityweb:4240957:33)
    invoke_viiii (FB_WebGL.asm.framework.unityweb:17734:26)
    _HTTPRequest_CallCallback_m2640281423 (FB_WebGL.asm.code.unityweb:2682004:15)
    dynCall_vii (FB_WebGL.asm.code.unityweb:4332038:32)
    invoke_vii (FB_WebGL.asm.framework.unityweb:17806:24)
    _ConnectionBase_HandleCallback_m3535074261 (FB_WebGL.asm.code.unityweb:2121596:14)
    dynCall_vii (FB_WebGL.asm.code.unityweb:4332038:32)
    invoke_vii (FB_WebGL.asm.framework.unityweb:17806:24)
    _HTTPManager_OnUpdate_m2252696592 (FB_WebGL.asm.code.unityweb:121576:17)
    _HTTPUpdateDelegator_Update_m2271029028 (FB_WebGL.asm.code.unityweb:2965065:36)

    Do you know how can I fix it?

    Greetings,
    Nacho.
     
    Last edited: Jan 31, 2019
  36. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @ncortesp

    I would recommend to check the console's previous entries and the Network tab too. They can contain valuable information about what went wrong.

    What i can guess is that different browsers have different CORS policy, and what works with chrome will fail on others.
     
  37. ncortesp

    ncortesp

    Joined:
    Oct 28, 2016
    Posts:
    34
    What I've seen is that in Chrome it doesn't work too, but It doesn't throw any error that's why I did not see that.

    Do you have any idea about what's wrong?

    This is how I'm initiating the SignalRManager.cs script;

    Code (CSharp):
    1. void Start()
    2.     {
    3.         Uri uri = new Uri(_URI);
    4.         _challengesHub = new Hub(_HUBNAME);
    5.  
    6.         PlatformSupport.Collections.ObjectModel.ObservableDictionary<string, string> userdict = new PlatformSupport.Collections.ObjectModel.ObservableDictionary<string, string>();
    7.         userdict.Add("name", GameManager.instance.userId);
    8.         userdict.Add("source", GameManager.instance.gameName);
    9.  
    10.         signalRConnection = new Connection(uri, _challengesHub);
    11.         signalRConnection.AdditionalQueryParams = userdict;
    12.         signalRConnection.Open();
    13.  
    14.         SubscribeEvents();
    15.         SubscribeMethods();
    16.     }
    17.  
    Greetings,
    Nacho.
     
  38. unity_xcn5ifWOKH8_nQ

    unity_xcn5ifWOKH8_nQ

    Joined:
    Oct 1, 2018
    Posts:
    1
    Hi, I'm working with Socket.IO and Best HTTP and I have something like the following code:

    Code (CSharp):
    1. public void functionA(Object object)
    2.     {
    3.         string json = "{\"test\":" + object.test+ "," +
    4.                      "\"test2\":" + object.test2 + "," +
    5.                      "\"test3\":" + object.test3 + "," +
    6.                      "\"test4\":" + object.test4 + "}";
    7.  
    8.         socket.Emit("sendTest", OnTestCallback, json);
    9.     }
    10.  
    11. void OnTestCallback(Socket socket, Packet originalPacket, params object[] args)
    12.     {
    13.        //OnTestCallback
    14.     }
    15.  
    16.  
    My question is, can I pass my object ("object") from functionA to OnTestCallback?

    Thank you.
     
  39. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @ncortesp

    Your code is good. However the browser's CORS policy can abort a request if the CORS pre-flight request fails for various reasons. These reasons can be different on different browsers. That's why you should check the console and network tabs for additional information.
    You can also enable more detailed stack traces and debug symbols under Player Settings/Publishing Settings.
     
    ncortesp likes this.
  40. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
  41. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    Support notice: I will be out of office for about a week. My availability will be limited this time. There's a high chance that I can answer mails and forum posts when I'm back again.
     
  42. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    393
    Hi, I'm using BestHTTP with Socket.io, but can't find a few things in the doc, please help.

    1. How to let BestHTTP connects to a room?

    2. Can BestHTTP returns socket/client list of a namespace/room?
     
  43. a_d_69

    a_d_69

    Joined:
    Jun 7, 2017
    Posts:
    9
    @BestHTTP
    On the Iphone 6, the download of bundles is very slow. Before the download starts, my application takes up 300MB of RAM. Compared with the standard tools of loading of the bundles, loading through the plugin works about 10 times slower. In addition, over time, the download speed decreases and sometimes stops. I have a feeling that there is some limited buffer that prevents loading. In the process of downloading, RAM consumption is almost unchanged. I tried to use Download Streaming with 1mb part, but did not see the difference. The size of the bundle is 10 mb. The problem is only on this phone. It has a RAM limit on the application 650mb.
     
  44. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @zhuchun

    1.) Rooms are completely server side features.
    2.) No. Only the server knows about the connected client.
     
    zhuchun likes this.
  45. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @a_d_69

    Please turn on verbose logging for the plugin and send the logs to me:
    Code (CSharp):
    1. BestHTTP.HTTPManager.Logger.Level = BestHTTP.Logger.Loglevels.All;
     
  46. isidro02139

    isidro02139

    Joined:
    Jul 31, 2012
    Posts:
    72
    Dear BestHTTP –

    Thanks for developing AND supporting the BestHTTP Unity Asset, it's a real time saver! Recently, I experienced a unique socket issue that may be related to BestHTTP (or our configuration thereof); I hope it's ok to ask the community's opinion about this.

    – (background) –
    We have a Unity app (2017.4 LTS) that uses BestHTTP's WebSocket class to connect with Microsoft's speech-to-text service (also called "Bing"). We have built the app for PC, Mac, iOS and Android without issue. However, on a particular wifi network (my colleague's home network), the socket connection / service is not working.

    The "bad" network is configured to work with the upstream ISP via PPPoE; the routers we tried both had a MTU setting < 1500, which I have read can cause issues. I also tried using port 1080 instead of 80 (read here), but this change still failed on the bad network and worked fine on regular networks. I also have raw adb logcat dumps for the bad network and a working network.


    Thanks so much for taking the time to read this! I'm honestly just seeking any advice from anyone on how to attack this problem ~
     
  47. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @isidro02139

    1.) HTTP is done over TCP, and TCP can fragment messages to MTU size.
    2.) Port numbers < 1024 can be a problem when you try to host a server. The plugin uses port numbers assigned by the system.

    Could you set the plugin's log level to verbose and send the log to me after an unsuccessful connection attempt?
    Code (CSharp):
    1. BestHTTP.HTTPManager.Logger.Level = BestHTTP.Logger.Loglevels.All;
     
    isidro02139 likes this.
  48. a_d_69

    a_d_69

    Joined:
    Jun 7, 2017
    Posts:
    9
    https://pastebin.com/AWwuFbDZ
     
  49. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,406
    @a_d_69

    The first thing i would suggest is to update the plugin and try again and send a new log if it still happens. In the latest version there's a lot of optimization.
     
  50. a_d_69

    a_d_69

    Joined:
    Jun 7, 2017
    Posts:
    9
    I updated the plugin and tested the download in two modes: normal and with download streaming.
    Download speed has not changed. Still loading the bundle in 10mb, I'm waiting for 7-8 minutes.
    Here are the logs of the two download modes.
    https://pastebin.com/51ij3WHd
    https://pastebin.com/SqRWgtf6
     
unityunity