Search Unity

Best HTTP Released

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

  1. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Hi, after the last update I started getting null responses randomly when doing several requests quickly. The exception is:
    "Sharing violation on path [myLocalUnityFolder]/HTTPCache/33B"

    this is the stacktrace:
    Code (CSharp):
    1. at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
    2. at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode) [0x00000] in <d7ac571ca2d04b2f981d0d886fa067cf>:0
    3. at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode)
    4. at BestHTTP.PlatformSupport.FileSystem.DefaultIOService.CreateFileStream (System.String path, BestHTTP.PlatformSupport.FileSystem.FileStreamModes mode) [0x00049] in /Assets/Best HTTP (Pro)/BestHTTP/PlatformSupport/FileSystem/DefaultIOService.cs:17
    5. at BestHTTP.Caching.HTTPCacheFileInfo.Store (BestHTTP.HTTPResponse response) [0x00045] in /Assets/Best HTTP (Pro)/BestHTTP/Caching/HTTPCacheFileInfo.cs:328
    6. at BestHTTP.Caching.HTTPCacheService.Store (System.Uri uri, BestHTTP.HTTPMethods method, BestHTTP.HTTPResponse response) [0x000e4] in /Assets/Best HTTP (Pro)/BestHTTP/Caching/HTTPCacheService.cs:394
    7. at BestHTTP.HTTPConnection.TryStoreInCache () [0x00095] in /Assets/Best HTTP (Pro)/BestHTTP/HTTPConnection.cs:688
    8. at BestHTTP.HTTPConnection.ThreadFunc () [0x004fc] in /Assets/Best HTTP (Pro)/BestHTTP/HTTPConnection.cs:336
    If I do several requests quickly, some of them will trigger this exception most of the time.

    Thanks
     
    Last edited: Jun 9, 2019
  2. yanlevesque

    yanlevesque

    Joined:
    Mar 15, 2018
    Posts:
    2
     
  3. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Yes, I do call a bunch of URLs in a loop and some of them can be the same (I sometimes need several copies of the same file).
     
    Last edited: Jun 11, 2019
  4. BestHTTP

    BestHTTP

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

    Thanks for the report, i'm going to investigate it. You can disable caching for your requests that might be sent out multiple times, or you can downgrade to the previous version (v1.11.x).
     
  5. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Lost-in-the-Garden

    Received an answer yesterday from Unity:
     
    LTPStudioXR likes this.
  6. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Thank you, I downgraded for now, no worries
     
  7. BestHTTP

    BestHTTP

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

    Just fixed it, it will be in the next release (v1.12.2).
     
  8. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    Amazing! Thank you so much
     
  9. BestHTTP

    BestHTTP

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

    v1.12.2 went live today, let me know how it works if you give it a try.
     
    Numa likes this.
  10. AnnabelleD

    AnnabelleD

    Joined:
    Mar 2, 2017
    Posts:
    2
    Hi, the cache maintenance doesn't work. It seems this if statement is keeping it from clearing up the cache:
    Code (CSharp):
    1. if (DeleteEntity(kvp.Key, false))
    2.     removedEntities.Add(kvp.Value);
    on line 532 in the function MaintananceImpl. If I comment it and add the entity to the removedEntities directly it works fine.
     
  11. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    Hello, I just bought the Asset a few days ago and am now beginning to use it.

    From what I understand, the asset can do HTTPS requests, but does it actually validate (verify) the server certificates?

    If not, how could I do it? Has anyone been able to do it?
     
    Last edited: Jun 21, 2019
  12. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @chanon81

    Yes, HTTPS request are supported. If your url is something that start with https:// than it will use SSL/TLS to encrypt the communication.

    It doesn't do validation by default, it accepts all certification. You can implement the Org.BouncyCastle.Crypto.Tls.ICertificateVerifyer interface and set it to the HTTPManager.DefaultCertificateVerifyer property.

    I'm sure someone done it properly, but i can't route you to anyone for guidance. Unfortunately i'm not a security guy, and i'm sure my attempts had big flaws if these attempts were in the right direction at all.
     
    chanon81 likes this.
  13. polytropoi

    polytropoi

    Joined:
    Aug 16, 2006
    Posts:
    681
    Is it possible to use socket.io peer-to-peer with BestHTTP, or might it be possible in the future? Any plans for webrtc support? Your plugin is awesome, I use it for various things, but now I dare to humbly ask - what about p2p?
     
  14. mathias_unity633

    mathias_unity633

    Joined:
    Jul 17, 2018
    Posts:
    35
    Hi! I'm trying to setup SignalR Core using BestHTTP.
    I'm getting this error:

    Code (CSharp):
    1. Signal R Error : The 'WebSockets' transport isn't supported by the server!

    I opened a ticket here:
    https://github.com/aspnet/AspNetCore/issues/11898

    Judging from code, I am assuming there is something I have to do differently on the server-side, not on the client-side? Correct me if I'm wrong! My setup is quite straight-forward:


    Code (CSharp):
    1.        
    2.         public static async void Connect()
    3.         {
    4.             var endpoint = $"{ConfigurationManager.Settings.ContentServiceURL}/{_signalREndPoint}";
    5.             var uri = new Uri(endpoint);
    6.            
    7.             HubOptions options = new HubOptions();
    8.             options.SkipNegotiation = false;
    9.  
    10.             _hub = new HubConnection(uri, new JsonProtocol(new LitJsonEncoder()), options);
    11.  
    12.             _hub.OnConnected += con => Debug.Log("Connected to the SignalR server!");
    13.             _hub.OnClosed += con => Debug.Log("Connection to the SignalR server was closed!");
    14.             _hub.OnError += (con, err) => Debug.Log($"Signal R Error : {err}");
    15.  
    16.             _hub.On<ObjectMovedParameter>("MoveObject", MoveObject);
    17.  
    18.             _hub.StartConnect();
    19.  
    20.         }
     
  15. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @polytropoi

    WebRTC is on my todo list, but no ETA on it. I have no plan to add p2p.

    Currenctly I'm focusing on http/2.
     
    polytropoi likes this.
  16. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
  17. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    186
    Hi,

    We have now converted all UnityWebRequest commands to the BestHttp Commands, but we are forcing some performence problems.

    The requested page is a very small json < 5 lines and BestHttp uses +2 seconds.

    http://SOME-COMPUTER:8000/api/Cloud/GetInfo UnityWebRequest:00:00:00:0210
    http://SOME-COMPUTER:8000/api/Cloud/GetInfo TOOK:00:00:02:0022

    Please find below our setup:

    Code (CSharp):
    1.  
    2.         private IEnumerator UnityWebRequestTestAsync()
    3.         {
    4.             Stopwatch stopwatch = new Stopwatch(true);
    5.             UnityWebRequest request = new UnityWebRequest("http://SOME-COMPUTER:8000/api/Cloud/GetInfo");
    6.             yield return request.SendWebRequest();
    7.             Debug.Log(stopwatch.StopAndGetFormatedElaspedTimeString("UnityWebRequest"));
    8.         }
    9.  
    10.         private IEnumerator BestHttpRequestTestAsync()
    11.         {
    12.             HTTPManager.KeepAliveDefaultValue = true;
    13.             HTTPManager.EnablePrivateBrowsing = true;
    14.             HTTPManager.IsCachingDisabled = true;
    15.             HTTPManager.IsCookiesEnabled = false;
    16.             HTTPManager.MaxConnectionPerServer = 10;
    17.             HTTPManager.MaxConnectionIdleTime = TimeSpan.Zero;
    18.             HTTPManager.ConnectTimeout = TimeSpan.FromSeconds(15);
    19.             //HTTPManager.ConnectTimeout = TimeSpan.FromSeconds(0); //tried this, too...
    20.             HTTPUpdateDelegator.IsThreaded = true;
    21.             HTTPUpdateDelegator.ThreadFrequencyInMS = 1;
    22.             HTTPManager.Setup();
    23.  
    24.             Stopwatch stopwatch = new Stopwatch(true);
    25.  
    26.             HTTPRequest request = new HTTPRequest(new System.Uri("http://SOME-COMPUTER:8000/api/Cloud/GetInfo"));
    27.             request.IsCookiesEnabled = false;
    28.             request.DisableCache = true;
    29.             request.Priority = -1;
    30.  
    31.             yield return request.Send();
    32.             //yield return m_cloudAPIController.GetVersionInfosFromCloud();
    33.             Debug.Log(stopwatch.StopAndGetFormatedElaspedTimeString("BestHttp"));
    34.         }
    35.  
    36.         private void LateUpdate()
    37.         {
    38.             if (Input.GetKeyDown(KeyCode.Space)) {
    39.                 StartCoroutine(UnityWebRequestTestAsync());          
    40.             }
    41.             if (Input.GetKeyDown(KeyCode.Return)) {
    42.                 StartCoroutine(BestHttpRequestTestAsync());
    43.             }
    44.         }

    If I take a look at the webserver, it takes nearly 2 seconds until the server gets the request and sends the response, so it looks something else is wrong here.
    The webserver is running on the computer where the above Script is executed.

    When changing the url from "SOME-COMPUTER" to the IP address of the computer/or 127.0.0.1 it is faster then the UnityWebRequest! :)

    However, it lookt like the name resolution or the like is taking so much time.

    Is there any way to handle this, because in our real scenario, only the computer-name is available to us, not the ip address?

    This is on a Windows-10 System. Devices from outside are connecting really quick, so no Performence Problem there.

    Thank you!

    Regards
    André
     
    Last edited: Jul 9, 2019
  18. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Zapan15

    DNS querying is done by the .net framework supplied Dns class. If ConnectTimeout is zero the plugin uses Dns.GetHostAddresses otherwise Dns.BeginGetHostAddresses. Sometime switching between these can resolve some issues, but as i see you already tried it out.

    Because these are system functions i can recommend to try to clear the test machine's dns cache and/or try it with a different version of unity.

    I'm happy though that if dns querying works correctly the plugin comes out quicker than UnityWebRequest! :)
     
  19. HLMR

    HLMR

    Joined:
    Jul 9, 2019
    Posts:
    3
    Hi BestHttp,

    I am using your Asset for a project which is server side a .NET Core application and client side a HoloLens.

    In order to communicate between server and client I am using Hubs and therefore specifically HubConnection from your asset.
    Almsot everything works fine for me. I can connect to specific hubs, receive messages from server but when trying to close the HubConnection with the call StartClose() a NullReferenceException occurs in the BestHttp.Websocket.WebSocketResponse class (see attachment) with following information:


    System.NullReferenceException: Object reference not set to an instance of an object
    at BestHTTP.WebSocket.WebSocketResponse.ReceiveThreadFunc () [0x00261] in C:\MyTestProject\Assets\Frameworks\Best HTTP (Pro)\BestHTTP\WebSocket\WebSocketResponse.cs:527
    at BestHTTP.PlatformSupport.Threading.ThreadedRunner+<RunLongLiving>c__AnonStorey4.<>m__0 (System.Object param) [0x00006] in C:\MyTestProject\Assets\Frameworks\Best HTTP (Pro)\BestHTTP\PlatformSupport\Threading\ThreadedRunner.cs:83
    at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00025] in <cfc149f8218b496788d8493c87de777a>:0
    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <cfc149f8218b496788d8493c87de777a>:0
    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <cfc149f8218b496788d8493c87de777a>:0
    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <cfc149f8218b496788d8493c87de777a>:0
    at System.Threading.ThreadHelper.ThreadStart (System.Object obj) [0x0000f] in <cfc149f8218b496788d8493c87de777a>:0 occurred


    The error string I receive when the OnError event is called is:


    Request Finished with Error! Exception: TCP Stream closed unexpectedly by the remote server at BestHTTP.WebSocket.Frames.WebSocketFrameReader.ReadByte (System.IO.Stream stream) [0x0000f] in C:\MyTestProject\Assets\Frameworks\Best HTTP (Pro)\BestHTTP\WebSocket\Frames\WebSocketFrameReader.cs:154
    at BestHTTP.WebSocket.Frames.WebSocketFrameReader.Read (System.IO.Stream stream) [0x00004] in C:\MyTestProject\Assets\Frameworks\Best HTTP (Pro)\BestHTTP\WebSocket\Frames\WebSocketFrameReader.cs:60
    at BestHTTP.WebSocket.WebSocketResponse.ReceiveThreadFunc () [0x00021] in C:\MyTestProject\Assets\Frameworks\Best HTTP (Pro)\BestHTTP\WebSocket\WebSocketResponse.cs:417


    Nevertheless everything seems to work fine so far. I can connect to Hubs without any problems again after the connection "failed" to close before.
     

    Attached Files:

  20. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @HLMR

    Thank you for the report, the fix will be in the next release!
     
  21. Philip-ACN

    Philip-ACN

    Joined:
    Oct 25, 2018
    Posts:
    21
    Hello, I have a question. I'm using this in a project but I'm getting a hang when receiving data. Is there a way to have this plugin running either in a co-routine or in another thread so that it doesn't interrupt the main thread?

    Basically, were receiving 3D object mesh dataover a socket every 5 seconds which is causing a slight hang when the data is received. We need to receive this data without the hang. (Processing the data isn't the cause as it's been tested, the delay is caused when receiving the data.)
     
  22. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Philip-ACN

    What protocol are you using? Regular http, or a higher level one like websocket, socketio, signalr?

    The plugin uses threads to send and receive data, so that shouldn't cause hangs either.
     
  23. Philip-ACN

    Philip-ACN

    Joined:
    Oct 25, 2018
    Posts:
    21
    We're using socket.io on our own AWS instance.

    We think we've narrowed the hang to the garbage collector. We're seeing GC allocation of 280Mb. Yes, megabytes...
    We're assuming that all the (de)serialising to/from strings is causing a huge collection of now useless strings which is quickly filling the heap. We tried serializing our binary data directly but it seems BestHTTP will convert the data into a a string before sending anyway.
     
  24. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Philip-ACN

    If the plugin detects a byte[] in an Emit call, it will send it as a binary data without encoding it to a string. Otherwise, because socket.io is a textual protocol the arguments will be converted to a json string and sent as is. So, if you have for example a class that contains the binary data, you should send it separately otherwise the json encoder will try to create a string from it.
     
  25. Philip-ACN

    Philip-ACN

    Joined:
    Oct 25, 2018
    Posts:
    21
    Thanks, we'll give it a try.
     
  26. farmerdwight

    farmerdwight

    Joined:
    Oct 4, 2015
    Posts:
    4
    Hi, I am trying to make a ws:// websocket connection with a url, username and password. Here is a stripped down version of my code which is not successfully connecting. I'm not sure that I am using the credentials properly. Any suggestions? Thanks.

    Code (CSharp):
    1. webSocket = new WebSocket.WebSocket(new Uri(url));
    2.  
    3. webSocket.InternalRequest.Proxy = new HTTPProxy(new Uri(url), new Credentials(username, password), true);
    4.  
    5. webSocket.OnOpen += OnOpen;
    6. webSocket.OnMessage += OnMessageReceived;
    7. webSocket.OnClosed += OnClosed;
    8. webSocket.OnError += OnError;
    9.  
    10. webSocket.Open();
     
  27. Philip-ACN

    Philip-ACN

    Joined:
    Oct 25, 2018
    Posts:
    21
    Here's my working code... :)
    Your ws:// URI goes here... new SocketManager( new Uri( EnterURIHere ), options );


    Code (CSharp):
    1.  
    2.     private SocketManager manager;
    3.  
    4.     [Header( "Enter the URL of the socket server." )]
    5.     public string uri;
    6.  
    7.     private void Start()
    8.     {
    9.         //Only do this once:
    10.         //Set options and log in details
    11.         SocketOptions options = new SocketOptions();
    12.         options.AutoConnect = false;
    13.         options.AdditionalQueryParams = new PlatformSupport.Collections.ObjectModel.ObservableDictionary<string, string>();
    14.         options.AdditionalQueryParams.Add( "user", "user" );
    15.      
    16.         //Create a new socketmanager with the settings
    17.         manager = new SocketManager( new Uri( uri ), options );
    18.  
    19.         //Setup a callback to the DataHasBeenGimmed method, after receiving data on the 'gimme-teh-data' channel
    20.         manager.Socket.On( "gimme-teh-data", DataHasBeenGimmed );
    21.  
    22.         manager.Open();
    23.     }
    I attach this script to an empty GameObject, which I use for all my communications. Just set the URI in the inspector
     
  28. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @davidpmontes

    If you want to send credentials in your url, than you should construct the url as such.
    By setting the internal request's Proxy to your url will result in failed connections if that url isn't truly a proxy.
     
  29. farmerdwight

    farmerdwight

    Joined:
    Oct 4, 2015
    Posts:
    4
    Thanks, that worked and I can connect to my websocket in the Unity Editor. However, the connection doesn't work when deployed to the Hololens. Is the Hololens still supported?
     
  30. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @davidpmontes

    It should work, but without seeing the plugin's logs, i can't say too much. You can set the plugin's log level to verbose by adding this line somewhere in your startup code:
    Code (CSharp):
    1. BestHTTP.HTTPManager.Logger.Level = BestHTTP.Logger.Loglevels.All;
     
  31. applet_llc

    applet_llc

    Joined:
    Feb 1, 2018
    Posts:
    4
    Hi. In my project, I want to access WebDav. When I searched this forum, I could not find any exchanges with the keywords of WebDav and PROPFIND. Please tell me how to write the code to send PROPFIND and receive the result.
     
  32. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @applet_llc

    The plugin doesn't support WebDav out of the box. You can however set up a HTTPRequest to execute a PROFIND query on a webdav server by referring to RFC 4918.
     
  33. polytropoi

    polytropoi

    Joined:
    Aug 16, 2006
    Posts:
    681
  34. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @polytropoi

    If it's built on the vanilla Socket.IO protocol emitting an subscribing stream related events, then yes, it should handle those events just like any other events. I don't know how it's implemented so i can't say for sure.
     
  35. prabhjotlamba

    prabhjotlamba

    Joined:
    Jun 2, 2018
    Posts:
    6
    Hi, I had a small doubt.
    I am using Socketio and wanted to know how to set Headers for Authorization when creating a new instance of the Socket Manager class?
     
  36. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @prabhjotlamba

    Because the WebSocket transport can't support additional headers under WebGL, you can add only query parameters:
    Code (CSharp):
    1. SocketOptions options = new SocketOptions();
    2. options.AdditionalQueryParams = new PlatformSupport.Collections.ObjectModel.ObservableDictionary<string, string>();
    3. options.AdditionalQueryParams.Add("authorization", "token");
    4.  
    5. Manager = new SocketManager(new Uri("https://.../socket.io/"), options);
     
  37. prabhjotlamba

    prabhjotlamba

    Joined:
    Jun 2, 2018
    Posts:
    6
    Awesome will try that, thanks!
     
  38. prabhjotlamba

    prabhjotlamba

    Joined:
    Jun 2, 2018
    Posts:
    6
    Also found one small issue while working with the library. Unity Console was giving errors when i clicked on a log item. That was happening due to Parenthesis in the Folder name Best HTTP (Pro) <-- in Unity version 2019.1.10

    Removing the parenthesis fixed the problem. You can check the link here: issuetracker.unity3d.com/issues/console-window-contents-disappear-when-a-certain-debug-dot-log-message-is-clicked
     
  39. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @prabhjotlamba

    Reported it to Unity and received an answer from them:
     
    prabhjotlamba likes this.
  40. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    186
    @BestHTTP

    Is it good practice, to reuse (with a pool) the HTTPRequest object, like for uploading, downloading etc. (to avoid creating for each Request a new object)?

    The HTTPMethods would be not the same, the url Neither which means completly different upload, download types for the Request. etc...

    If we can use a way of Pooling with HTTPRequest, which methods should we call before reusing the Object (Clear, Reset,... ?)?

    Thank you
     
  41. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Zapan15

    I wouldn't recommend. A HTTPRequest isn't a memory hungry one, although it's still a class producing GC garbage. Only one header of a request/response produces more garbage than a HTTPRequest instance.
     
  42. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    186
    Thank you!
     
  43. Fatih86

    Fatih86

    Joined:
    Mar 3, 2014
    Posts:
    7
    Hi,

    When I send mutated vowels ü ö ä from server, my socketmanager crashes. Any ideas what can couse this.

    br
     
  44. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Fatih86

    Could you try it out with the websocket transport?
    Code (CSharp):
    1. SocketIO.SocketOptions options = new SocketIO.SocketOptions();
    2. options.ConnectWith = SocketIO.Transports.TransportTypes.WebSocket;
    3.  
    4. var manager = new BestHTTP.SocketIO.SocketManager(new Uri("https://server/socket.io/"), options);
     
  45. Fatih86

    Fatih86

    Joined:
    Mar 3, 2014
    Posts:
    7
    Hey,

    I am getting this error after setting options.ConnectWith - I can't read something usefull from this.

    Code (CSharp):
    1. 0x00007FF69E4A93CC (Unity) StackWalker::GetCurrentCallstack
    2. 0x00007FF69E4AC881 (Unity) StackWalker::ShowCallstack
    3. 0x00007FF69CC18695 (Unity) GetStacktrace
    4. 0x00007FF69EEC6C60 (Unity) DebugStringToFile
    5. 0x00007FF69E4D7EC9 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    6. 0x00000211315407CB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    7. 0x000002113154040B (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    8. 0x000002113153FD01 (Mono JIT Code) [Logger.cs:61] UnityEngine.Logger:Log (UnityEngine.LogType,object)
    9. 0x000002113CC6DD7D (Mono JIT Code) [Debug.bindings.cs:127] UnityEngine.Debug:LogError (object)
    10. 0x000002113CC6DC43 (Mono JIT Code) [Deb.cs:17] Deb:Err (string)
    11. 0x000002114274944B (Mono JIT Code) [NetworkManager.cs:332] NetworkManager:OnError (BestHTTP.SocketIO.Socket,BestHTTP.SocketIO.Packet,object[])
    12. 0x0000021142748C66 (Mono JIT Code) [EventDescriptor.cs:74] BestHTTP.SocketIO.Events.EventDescriptor:Call (BestHTTP.SocketIO.Socket,BestHTTP.SocketIO.Packet,object[])
    13. 0x000002114225BBF3 (Mono JIT Code) [EventTable.cs:84] BestHTTP.SocketIO.Events.EventTable:Call (string,BestHTTP.SocketIO.Packet,object[])
    14. 0x000002114225B773 (Mono JIT Code) [Socket.cs:448] BestHTTP.SocketIO.Socket:BestHTTP.SocketIO.ISocket.EmitEvent (string,object[])
    15. 0x000002114225B2DA (Mono JIT Code) [SocketManager.cs:562] BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitEvent (string,object[])
    16. 0x00000211427487CC (Mono JIT Code) [SocketManager.cs:570] BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitEvent (BestHTTP.SocketIO.SocketIOEventTypes,object[])
    17. 0x00000211427483ED (Mono JIT Code) [SocketManager.cs:575] BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitError (BestHTTP.SocketIO.SocketIOErrors,string)
    18. 0x00000211427481BA (Mono JIT Code) [SocketManager.cs:427] BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.OnTransportError (BestHTTP.SocketIO.Transports.ITransport,string)
    19. 0x0000021142747F35 (Mono JIT Code) [WebSocketTransport.cs:245] BestHTTP.SocketIO.Transports.WebSocketTransport:OnError (BestHTTP.WebSocket.WebSocket,System.Exception)
    20. 0x00000211427467AB (Mono JIT Code) [WebSocket.cs:344] BestHTTP.WebSocket.WebSocket:OnInternalRequestCallback (BestHTTP.HTTPRequest,BestHTTP.HTTPResponse)
    21. 0x0000021142745C40 (Mono JIT Code) [HTTPRequest.cs:1311] BestHTTP.HTTPRequest:CallCallback ()
    22. 0x000002114274590B (Mono JIT Code) [ConnectionBase.cs:161] BestHTTP.ConnectionBase:HandleCallback ()
    23. 0x00000211422B5FE3 (Mono JIT Code) [HTTPManager.cs:622] BestHTTP.HTTPManager:OnUpdate ()
    24. 0x00000211422AF1F3 (Mono JIT Code) [HTTPUpdateDelegator.cs:178] BestHTTP.HTTPUpdateDelegator:Update ()
    25. 0x000002113C0EA2C8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    26. 0x00007FFE6EBCBBCB (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
    27. 0x00007FFE6EB52252 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
    28. 0x00007FFE6EB5B25F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
    29. 0x00007FF69E43B036 (Unity) scripting_method_invoke
    30. 0x00007FF69E435335 (Unity) ScriptingInvocation::Invoke
    31. 0x00007FF69E3F1B42 (Unity) MonoBehaviour::CallMethodIfAvailable
    32. 0x00007FF69E3F1EE6 (Unity) MonoBehaviour::CallUpdateMethod
    33. 0x00007FF69DB20444 (Unity) BaseBehaviourManager::CommonUpdate<BehaviourManager>
    34. 0x00007FF69DB28A44 (Unity) BehaviourManager::Update
    35. 0x00007FF69DF575A3 (Unity) `InitPlayerLoopCallbacks'::`2'::UpdateScriptRunBehaviourUpdateRegistrator::Forward
    36. 0x00007FF69DF40AB8 (Unity) ExecutePlayerLoop
    37. 0x00007FF69DF40B96 (Unity) ExecutePlayerLoop
    38. 0x00007FF69DF45750 (Unity) PlayerLoop
    39. 0x00007FF69CC66C30 (Unity) PlayerLoopController::UpdateScene
    40. 0x00007FF69CC63CA9 (Unity) Application::TickTimer
    41. 0x00007FF69CF23943 (Unity) MainMessageLoop
    42. 0x00007FF69CF2D347 (Unity) WinMain
    43. 0x00007FF69F85DD8E (Unity) __scrt_common_main_seh
    44. 0x00007FFED1087974 (KERNEL32) BaseThreadInitThunk
    45. 0x00007FFED20CA271 (ntdll) RtlUserThreadStart
     
  46. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Fatih86

    That seems to be a crash in Unity/mono. What version of Unity are you using? What platform the crash occurred?
     
  47. Fatih86

    Fatih86

    Joined:
    Mar 3, 2014
    Posts:
    7
    I am using Unity Version 2019.1.0f2 Personal on Windows 10
     
  48. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Fatih86

    I would highly recommend to try it out with the latest version (2019.1.11f1 as of now)!
     
  49. Fatih86

    Fatih86

    Joined:
    Mar 3, 2014
    Posts:
    7
    Updated but didnt help.

    When I run the application I get the following Network error.

    Code (CSharp):
    1.  
    2. Code: Internal Message: "Request Finished Successfully, but the server sent an error. Status Code: 400-Bad Request Message: {"code":3,"message":"Bad request"}"
    3. 0x00007FF77BDF818C (Unity) StackWalker::GetCurrentCallstack
    4. 0x00007FF77BDFB641 (Unity) StackWalker::ShowCallstack
    5. 0x00007FF77A55AFF5 (Unity) GetStacktrace
    6. 0x00007FF77C81DE20 (Unity) DebugStringToFile
    7. 0x00007FF77BE26E69 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    8. 0x0000024B14B2FEAB (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    9. 0x0000024B14B2FAEB (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    10. 0x0000024B14B2F181 (Mono JIT Code) [Logger.cs:61] UnityEngine.Logger:Log (UnityEngine.LogType,object)
    11. 0x0000024B14B2EDE0 (Mono JIT Code) [Debug.bindings.cs:99] UnityEngine.Debug:Log (object)
    12. 0x0000024B16EA3A1B (Mono JIT Code) [NetworkManager.cs:369] NetworkManager:OnError (BestHTTP.SocketIO.Socket,BestHTTP.SocketIO.Packet,object[])
    13. 0x0000024B16EA2DE6 (Mono JIT Code) [EventDescriptor.cs:74] BestHTTP.SocketIO.Events.EventDescriptor:Call (BestHTTP.SocketIO.Socket,BestHTTP.SocketIO.Packet,object[])
    14. 0x0000024B14710313 (Mono JIT Code) [EventTable.cs:84] BestHTTP.SocketIO.Events.EventTable:Call (string,BestHTTP.SocketIO.Packet,object[])
    15. 0x0000024B104BFF23 (Mono JIT Code) [Socket.cs:448] BestHTTP.SocketIO.Socket:BestHTTP.SocketIO.ISocket.EmitEvent (string,object[])
    16. 0x0000024B145AFEEA (Mono JIT Code) [SocketManager.cs:562] BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitEvent (string,object[])
    17. 0x0000024B16EA294C (Mono JIT Code) [SocketManager.cs:570] BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitEvent (BestHTTP.SocketIO.SocketIOEventTypes,object[])
    18. 0x0000024B16EA256D (Mono JIT Code) [SocketManager.cs:575] BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitError (BestHTTP.SocketIO.SocketIOErrors,string)
    19. 0x0000024B16EA233A (Mono JIT Code) [SocketManager.cs:427] BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.OnTransportError (BestHTTP.SocketIO.Transports.ITransport,string)
    20. 0x0000024B16EA20B5 (Mono JIT Code) [WebSocketTransport.cs:245] BestHTTP.SocketIO.Transports.WebSocketTransport:OnError (BestHTTP.WebSocket.WebSocket,System.Exception)
    21. 0x0000024B16EA092B (Mono JIT Code) [WebSocket.cs:344] BestHTTP.WebSocket.WebSocket:OnInternalRequestCallback (BestHTTP.HTTPRequest,BestHTTP.HTTPResponse)
    22. 0x0000024B16E9FB90 (Mono JIT Code) [HTTPRequest.cs:1311] BestHTTP.HTTPRequest:CallCallback ()
    23. 0x0000024B16E9F85B (Mono JIT Code) [ConnectionBase.cs:161] BestHTTP.ConnectionBase:HandleCallback ()
    24. 0x0000024B148C1333 (Mono JIT Code) [HTTPManager.cs:622] BestHTTP.HTTPManager:OnUpdate ()
    25. 0x0000024B1479B083 (Mono JIT Code) [HTTPUpdateDelegator.cs:178] BestHTTP.HTTPUpdateDelegator:Update ()
    26. 0x0000024B1465A2E8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    27. 0x00007FFE7316B6B0 (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
    28. 0x00007FFE730F1D12 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
    29. 0x00007FFE730FAD0F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
    30. 0x00007FF77BD8A0B6 (Unity) scripting_method_invoke
    31. 0x00007FF77BD843A5 (Unity) ScriptingInvocation::Invoke
    32. 0x00007FF77BD40A82 (Unity) MonoBehaviour::CallMethodIfAvailable
    33. 0x00007FF77BD40E26 (Unity) MonoBehaviour::CallUpdateMethod
    34. 0x00007FF77B465B44 (Unity) BaseBehaviourManager::CommonUpdate<BehaviourManager>
    35. 0x00007FF77B46E144 (Unity) BehaviourManager::Update
    36. 0x00007FF77B89F643 (Unity) `InitPlayerLoopCallbacks'::`2'::UpdateScriptRunBehaviourUpdateRegistrator::Forward
    37. 0x00007FF77B888B58 (Unity) ExecutePlayerLoop
    38. 0x00007FF77B888C36 (Unity) ExecutePlayerLoop
    39. 0x00007FF77B88D7F0 (Unity) PlayerLoop
    40. 0x00007FF77A5A8CA0 (Unity) PlayerLoopController::UpdateScene
    41. 0x00007FF77A5A5D28 (Unity) Application::TickTimer
    42. 0x00007FF77A8643EB (Unity) MainMessageLoop
    43. 0x00007FF77A86DDF7 (Unity) WinMain
    44. 0x00007FF77D1B653E (Unity) __scrt_common_main_seh
    45. 0x00007FFED1087974 (KERNEL32) BaseThreadInitThunk
    46.  
    Code (CSharp):
    1.  
    2.  
    3. using BestHTTP.SocketIO;
    4. using BestHTTP.SocketIO.Transports;
    5.  
    6. private SocketManager Manager;
    7. private SocketOptions options;
    8.  
    9. private void Connect()
    10. {
    11.     options = new SocketOptions();
    12.     options.AutoConnect = false;
    13.     options.ConnectWith = TransportTypes.WebSocket;
    14.     Manager = new SocketManager(new Uri("http://..../socket.io/"), options);
    15.  
    16.    // Incoming messages
    17.   Manager.Socket.On("Receiving", OnReceiving);
    18.  
    19. }
    20.  
    21. void OnReceiving(Socket socket, Packet packet, params object[] args)
    22. {
    23.   Debug.Log(args[0]);
    24. }
    25.  
    26.  
    this is how I use the socket. TransportTypes.Polling is working normally but crashes on receiving mutated vowels ü ö ä.
     
  50. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,664
    @Fatih86

    What's the version of your server? Is the websocket transport enabled?