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,609
    @stonstad

    The plugin doesn't try to use ConcurrenctDictionary, and it has its own ConcurrentQueue implementation for platforms it doesn't have implemented. However, it would generate a compile error only.
    No threads are used by the plugin, but other thread related classes are still there, usable and used. One example of these is the Interlocked and its methods. My demo page is compiled from the very same source than what's get distributed and it has no crashing while ConcurrentQueue is used every time when there's an event to dispatch (so quite frequently).
     
  2. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    333
  3. LR-Developer

    LR-Developer

    Joined:
    May 5, 2017
    Posts:
    109
    Hello,

    I got my WPF / Unity IPC via SignalR Core working now, using BestHTTP on unity part.

    but sometimes it seems to loose it's connection.

    On the WPF host side there is a "WithAutomaticReconnect".

    Code (CSharp):
    1.             _connection = new HubConnectionBuilder()
    2.                 .WithUrl(
    3.                     $"{_configData.Url}:{_configData.Port}/{_configData.HubName}",
    4.                     options => options.AccessTokenProvider = () => GetJwtToken(_configData.Key))
    5.                 .WithAutomaticReconnect()
    6.                 .Build();
    7.  
    Is there something like this in the BestHTTP component?

    Code (CSharp):
    1.                 _signalRClient = new HubConnection(new Uri(_url + ":" + Globals.SignalrCorePort + "/" + _hubName),
    2.                     new JsonProtocol(new LitJsonEncoder()))
    3.                 {    
    4.                     AuthenticationProvider = new HeaderAuthenticator(_jwtToken)
    5.                 };
    6.                 //HTTPManager.Logger.Level = BestHTTP.Logger.Loglevels.All;
    7.                 _signalRClient.OnMessage += OnMessageReceived;
    8.                 _signalRClient.OnError += OnError;
    9.                 _signalRClient.OnClosed += OnClosed;
    10.                 _signalRClient.OnConnected += OnConnected;
    11.                 _signalRClient.StartConnect();
    Code (CSharp):
    1.        private void OnError(HubConnection arg1, string arg2)
    2.         {
    3.             if (_signalRClient.State != ConnectionStates.Connected)
    4.             {
    5.                 Reconnect();
    6.             }
    7.         }
    8.  
    9.         private void OnClosed(HubConnection obj)
    10.         {
    11.             try
    12.             {
    13.                 if (!Application.isEditor && !_isQuitting)
    14.                 {
    15.                     TextPanelManager.Instance.AddText($"Connection closed: {obj.NegotiationResult}", TextPanelManager.TextLevel.Error);
    16.                     Reconnect();
    17.                 }
    18.             }
    19.             catch (System.Exception ex)
    20.             {
    21.                 ExceptionManager.HandleCaughtException($"Error in Reconnect:", ex);
    22.             }
    23.         }
    24.  

    Code (CSharp):
    1.         private void Reconnect()
    2.         {
    3.             try
    4.             {
    5.                 if (!_isQuitting)
    6.                 {
    7.                     TextPanelManager.Instance.SaveText(false);
    8.  
    9.                     GuiManager.Instance.SetLocked(true, "Connection lost, try to reconnect", GuiManager.LockReasons.ConnectionProblem);
    10.                     if (_signalRClient.State != ConnectionStates.Connected && _signalRClient.State != ConnectionStates.Authenticating)
    11.                     {
    12.                         TextPanelManager.Instance.AddText("Connection closed, try to reconnect", TextPanelManager.TextLevel.Error);
    13.  
    14.                         _signalRClient.AuthenticationProvider = new HeaderAuthenticator(_jwtToken);
    15.  
    16.                         _signalRClient.OnMessage -= OnMessageReceived;
    17.                         _signalRClient.OnError -= OnError;
    18.                         _signalRClient.OnClosed -= OnClosed;
    19.                         _signalRClient.OnConnected -= OnConnected;
    20.  
    21.                         _signalRClient.OnMessage += OnMessageReceived;
    22.                         _signalRClient.OnError += OnError;
    23.                         _signalRClient.OnClosed += OnClosed;
    24.                         _signalRClient.OnConnected += OnConnected;
    25.                         _signalRClient.StartConnect();
    26.                     }
    27.                 }
    28.             }
    29.             catch (System.Exception ex)
    30.             {
    31.                 ExceptionManager.HandleCaughtException("Error in SignalRCore Reconnect", ex);
    32.             }
    33.         }
    34.  
    It sometimes calls Reconnect, but this does not help...
     
    Last edited: Oct 6, 2020
  4. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @LR-Developer

    You can set a reconnect policy for the HubConnection. There's a DefaultRetryPolicy:
    Code (CSharp):
    1. hub = new HubConnection(...);
    2. hub.ReconnectPolicy = new DefaultRetryPolicy();
    but, you can implement your own too.
     
  5. Shankar-Ganesh

    Shankar-Ganesh

    Joined:
    Sep 23, 2013
    Posts:
    29
    @BestHTTP, Is there any way to hide/disable HTTPCache folder in Android? Or is there anyway to ignore to create this folder?
    Example, InternalStorage->Android->data->package name folder->files->HTTPCache. This folder I need to hide.

    Also will it cause any problem if we hide this? Please confirm.
     
    Last edited: Oct 6, 2020
  6. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
  7. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    333
    @BestHTTP Circling back on threading. BestHTTP appears to use C# user threads in WebGL -- could you confirm? This isn't supported according to https://forum.unity.com/threads/webgl-runtimeerror-memory-access-out-of-bounds.949842/#post-6385872, apparently. This is more a Unity issue than an asset issue -- I think BestHTTP is a terrific asset. I'm just trying to pin down the source of random threading crashes in a large WebGL application.

    *Updated -- BestHTTP uses these classes only in the Unity Editor.

    BestHTTP WebGL threading...
    upload_2020-10-6_11-42-51.png
     
    Last edited: Oct 6, 2020
  8. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @stonstad

    Are you debugging while running in the editor? Because under webgl a WebGLConnection is used instead of the regular HttpConnection, and well, WebGLConnection isn't using threads.
     
  9. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    333
    Yes -- confirmed that's the cause. I'll update my comment, above. I think it is terrific how well BestHTTP sidesteps these WebGL pitfalls.
     
  10. LR-Developer

    LR-Developer

    Joined:
    May 5, 2017
    Posts:
    109
    It is not here. And I searched overall and cannot find it anywhere.
    I guess it is in the Best Http/2 update?

    Thanks!
     
  11. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @LR-Developer Yes, it's introduced in the first release of BestHTTP/2.
     
  12. Avalin

    Avalin

    Joined:
    Oct 12, 2018
    Posts:
    72
    Hi!
    I am trying to establish a connection to the websocket echo server. I can both get a connection and a message through, but I cannot get it to close the connection appropriately.

    I have a websocket.Close() in my OnDestroy, as the example does, but instead I get an "OnError: Request Aborted!" when I am attempting to close the connection, but it never reaches the Close() call from OnDestroy.

    What could I be overlooking?
     
  13. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @Avalin When you receive this Request Aborted error? When you exiting from play mode in the editor?
     
  14. Avalin

    Avalin

    Joined:
    Oct 12, 2018
    Posts:
    72
    Yes exactly!
     
  15. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @Avalin OnClose and OnError are mutually exclusive, when OnError is closed no OnClosed going to be triggered. But, the connections is closed in both cases.

    With OnClose, the plugin could receive and send a close frame to the server, and even if there were some kind of error (protocol error, too big message, etc), the tcp connection is healthy and the server could inform the client that it's about to close the connection.

    On the other hand, when OnError is called, that's because something really bad happened (tcp channel disconnected for example). In case when the editor is exiting from play mode, the plugin has no time sending a close frame to the server and waiting for an answer, so it just shuts down everything immediately.
     
    Avalin likes this.
  16. Mandelboxed

    Mandelboxed

    Joined:
    Apr 17, 2015
    Posts:
    48
    Hi, I am seeing the following exception regularly and it seems to be occuring more or less at random. Sometimes the same request to the same URL will succeed, sometimes it will fail.

    Code (CSharp):
    1. Exception: Network error! TCP Connection got closed before receiving any data!
    2. BestHTTP.HTTPResponse.Receive (System.Int32 forceReadRawContentLength, System.Boolean readPayloadData, System.Boolean sendUpgradedEvent) (at Assets/Best HTTP/Source/HTTPResponse.cs:266)
    3. BestHTTP.Connections.HTTP1Handler.Receive (BestHTTP.HTTPRequest request) (at Assets/Best HTTP/Source/Connections/HTTP1Handler.cs:221)
    4. BestHTTP.Connections.HTTP1Handler.RunHandler () (at Assets/Best HTTP/Source/Connections/HTTP1Handler.cs:67)
    5. UnityEngine.Debug:LogException(Exception)
    6. <>c__DisplayClass16_0:<GetCollection>b__0(HTTPRequest, HTTPResponse) (at Assets/_Scripts/Collections/SvCollectionsController.cs:70)
    7. BestHTTP.Core.RequestEventHelper:HandleRequestStateChange(RequestEventInfo) (at Assets/Best HTTP/Source/Core/RequestEvents.cs:324)
    8. BestHTTP.Core.RequestEventHelper:ProcessQueue() (at Assets/Best HTTP/Source/Core/RequestEvents.cs:224)
    9. BestHTTP.HTTPManager:OnUpdate() (at Assets/Best HTTP/Source/HTTPManager.cs:381)
    10. BestHTTP.HTTPUpdateDelegator:Update() (at Assets/Best HTTP/Source/HTTPUpdateDelegator.cs:171)
    11.  
    This is happening in the latest version of BestHTTP 2 in the editor and in build (Unity 2018.4.25) and did not occur in Best HTTP 1. Any advice you can offer would be much appreciated.
     
  17. Mandelboxed

    Mandelboxed

    Joined:
    Apr 17, 2015
    Posts:
    48
    I saw another post with a similar problem in which case the solution was to set HTTPManager.KeepAliveDefaultValue = false.

    This appears to have worked. Let me know if there is a better approach.
     
  18. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @Mandelboxed Connection pooling can be one of the problems, because not every server let the client know about its settings. When you used HTTPManager.KeepAliveDefaultValue you turned connection pooling completely off however.
    An another setting that you can try to fine tune is the HTTPManager.MaxConnectionIdleTime. You can try a lower value than its default 20 seconds and further lowering it when the error you received previously appears again.
     
  19. mmkhajoo

    mmkhajoo

    Joined:
    Jul 4, 2018
    Posts:
    7
    hi in the example scene i get this error but in web-gl export in unity assets store works fine

    Error: Code: Internal Message: "Polling - Connection Timed Out! Uri: https://socket-io-chat.now.sh/socket.io/?EIO=4&transport=polling&t=1602792223436-0"
    UnityEngine.Debug:LogError(Object)
    BestHTTP.Examples.<>c:<OnConnectButton>b__22_2(Socket, Packet, Object[]) (at Assets/Best HTTP/Examples/SocketIO/SocketIOChatSample.cs:155)
    BestHTTP.SocketIO.Events.EventDescriptor:Call(Socket, Packet, Object[]) (at Assets/Best HTTP/Source/SocketIO/Events/EventDescriptor.cs:74)
    BestHTTP.SocketIO.Events.EventTable:Call(String, Packet, Object[]) (at Assets/Best HTTP/Source/SocketIO/Events/EventTable.cs:84)
    BestHTTP.SocketIO.Socket:BestHTTP.SocketIO.ISocket.EmitEvent(String, Object[]) (at Assets/Best HTTP/Source/SocketIO/Socket.cs:461)
    BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitEvent(String, Object[]) (at Assets/Best HTTP/Source/SocketIO/SocketManager.cs:566)
    BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitEvent(SocketIOEventTypes, Object[]) (at Assets/Best HTTP/Source/SocketIO/SocketManager.cs:574)
    BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.EmitError(SocketIOErrors, String) (at Assets/Best HTTP/Source/SocketIO/SocketManager.cs:579)
    BestHTTP.SocketIO.SocketManager:BestHTTP.SocketIO.IManager.OnTransportError(ITransport, String) (at Assets/Best HTTP/Source/SocketIO/SocketManager.cs:431)
    BestHTTP.SocketIO.Transports.PollingTransport:OnRequestFinished(HTTPRequest, HTTPResponse) (at Assets/Best HTTP/Source/SocketIO/Transports/PollingTransport.cs:219)
    BestHTTP.Core.RequestEventHelper:HandleRequestStateChange(RequestEventInfo) (at Assets/Best HTTP/Source/Core/RequestEvents.cs:312)
    BestHTTP.Core.RequestEventHelper:processQueue() (at Assets/Best HTTP/Source/Core/RequestEvents.cs:220)
    BestHTTP.HTTPManager:OnUpdate() (at Assets/Best HTTP/Source/HTTPManager.cs:369)
    BestHTTP.HTTPUpdateDelegator:Update() (at Assets/Best HTTP/Source/HTTPUpdateDelegator.cs:165)
     
  20. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
  21. mmkhajoo

    mmkhajoo

    Joined:
    Jul 4, 2018
    Posts:
    7
  22. jade915

    jade915

    Joined:
    Apr 24, 2018
    Posts:
    2
    So I am doing some basic testing of websockets. I have a server hosting the websocket server and my client is hosted on my website. My website certificate checks out and the info shows it is TLS 1.3. When I try and talk to my server from my client chrome is throwing the error "WebSocket connection to 'wss://my-site:9000/echo' failed: Error in connection establishment: net::ERR_SSL_OBSOLETE_VERSION". The only thing I can think of is that BestHTTP is sending on an older version of TLS? When I disable the chrome flag for deactivate old TLS and allow 1.0 and 1.1 it works fine. If it works fine in 1.0 and 1.1 but does not work in 1.2 something is using an old version? In my apache .conf I have tried "SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1" and "SSLProtocol -all +TLSv1.2" and a few other variants so I dont think its that but again I could be wrong.

    Thanks!
     
  23. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @jade915

    While the plugin under non-WebGL platforms supports TLS1.0-1.2, under WebGL the plugin must use the underlying browsers' WebSocket implementation and TLS and a lot of details are hidden and controlled by the browser. Unfortunately, if the connection fails in the browser, the plugin couldn't do anything about it.
     
  24. jade915

    jade915

    Joined:
    Apr 24, 2018
    Posts:
    2
    Okay, so if the browser is causing the problem thats where I will look next. Do you have any ideas for where I should start? I understand if you dont because the plugin isnt at fault in this case.
     
  25. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
  26. mmkhajoo

    mmkhajoo

    Joined:
    Jul 4, 2018
    Posts:
    7
    hi in Socket.io when I set AutoDecoder, False my object[] array is null

    the server returns the object[] I don't know why it's null.

    any solution?
     
  27. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @mmkhajoo If you set the AutoDecoder option to false, you're responsible to decode the payload, hence the args going to be null.
     
  28. unity3_unity131

    unity3_unity131

    Joined:
    Dec 9, 2019
    Posts:
    2
    Hello BestHTTP
    I use the best HTTP Pro plugin but I am having a problem when I go to buy in-app purchase, native popup open and buy in-app complete, back to app screen and socket automatically disconnected.
    how to fixed auto disconnect socket issue.
     
  29. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @unity3_unity131

    That's inevitable, unfortunately. When unity goes to the background its main thread stops updating the plugin can't send out pings and such so depending on the protocol and its settings it disconnects after some time.
    Don't know what protocol are you using, but you can use its reconnect logic if there's any, or you can reconnect manually.
     
  30. anonics

    anonics

    Joined:
    Nov 18, 2020
    Posts:
    2
    Hi, I want to connect with Socket.io, but the response of the official chat server is different from the response of the server I created, and I cannot connect to my server.
    <Official Chat Server Response>

    <My Server Response>

    When I look at DataAsText, the first "96:" of the data is missing.
    It seems that Length is overflowing because the ":" is missing.
    The server's node.js, express, socket.io are all the latest versions.
    Clients using Socket.io-client can communicate successfully.
     
    Last edited: Nov 18, 2020
  31. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @anonics Yes. The first one is a server with Socket.IO 2, while the second one is a server with Socket.IO 3. If you drop me a mail (besthttp@gmail.com) i can send you a package with Socket.IO 3 support that will be released in the next update.
     
  32. anonics

    anonics

    Joined:
    Nov 18, 2020
    Posts:
    2
    Thank you.
    Use socket.io2.
     
  33. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
  34. mmkhajoo

    mmkhajoo

    Joined:
    Jul 4, 2018
    Posts:
    7
    hi I got This error when i want to get response from my server it was ok but yesterday idk what my server guy did I get this error :

    {"tid":<b><color=yellow>1</color></b>,"div":"<b><color=blue>PollingTransport</color></b>","msg":"<b><color=maroon>ParseResponse</color></b>","ex": [{"msg": "Index was outside the bounds of the array.", "stack": " at BestHTTP.SocketIO.Transports.PollingTransport.ParseResponse (BestHTTP.HTTPResponse resp) [0x0011a] in C:\\Unity[Jobs]\\Monopoly\\Monopoly\\Assets\\Best HTTP\\Source\\SocketIO\\Transports\\PollingTransport.cs:393 "}],"stack":" at SocketIO.Transports.PollingTransport.ParseResponse (HTTPResponse resp) [0x002a7] in C:\\Unity[Jobs]\\Monopoly\\Monopoly\\Assets\\Best HTTP\\Source\\SocketIO\\Transports\\PollingTransport.cs:454 \r at SocketIO.Transports.PollingTransport.OnPollRequestFinished (HTTPRequest req, HTTPResponse resp) [0x00082] in C:\\Unity[Jobs]\\Monopoly\\Monopoly\\Assets\\Best HTTP\\Source\\SocketIO\\Transports\\PollingTransport.cs:270 \r at Core.RequestEventHelper.HandleRequestStateChange (Core.RequestEventInfo event) [0x00228] in C:\\Unity[Jobs]\\Monopoly\\Monopoly\\Assets\\Best HTTP\\Source\\Core\\RequestEvents.cs:313 \r at Core.RequestEventHelper.ProcessQueue () [0x002eb] in C:\\Unity[Jobs]\\Monopoly\\Monopoly\\Assets\\Best HTTP\\Source\\Core\\RequestEvents.cs:221 \r at HTTPManager.OnUpdate () [0x00001] in C:\\Unity[Jobs]\\Monopoly\\Monopoly\\Assets\\Best HTTP\\Source\\HTTPManager.cs:374 \r at HTTPUpdateDelegator.Update () [0x0001b] in C:\\Unity[Jobs]\\Monopoly\\Monopoly\\Assets\\Best HTTP\\Source\\HTTPUpdateDelegator.cs:171 ","ctxs":[],"t":637438373800501352,"ll":"Exception","bh":1}
    UnityEngine.Debug:LogError(Object)
    BestHTTP.Logger.UnityOutput:Write(Loglevels, String) (at Assets/Best HTTP/Source/Logger/UnityOutput.cs:22)
    BestHTTP.Logger.ThreadedLogger:WriteToOutput(LogJob) (at Assets/Best HTTP/Source/Logger/ThreadedLogger.cs:107)
    BestHTTP.Logger.ThreadedLogger:ThreadFunc() (at Assets/Best HTTP/Source/Logger/ThreadedLogger.cs:121)
    BestHTTP.PlatformSupport.Threading.<RunLongLiving>c__AnonStorey5:<>m__0(Object) (at Assets/Best HTTP/Source/PlatformSupport/Threading/ThreadedRunner.cs:98)
    System.Threading.ThreadHelper:ThreadStart(Object)
     
  35. mmkhajoo

    mmkhajoo

    Joined:
    Jul 4, 2018
    Posts:
    7
    i checked the line codes but i couldn't understand it well to fix out of bounds error.
     
  36. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @mmkhajoo If your server guy is involved in this mistery, than i think he/she might updated the Socket.IO package to Socket.IO 3. I would recommend to update to the latest version on your client side too.
     
  37. NXTech

    NXTech

    Joined:
    Jul 1, 2018
    Posts:
    2
    Hi, I'm trying to use the SSE functions with Firebase.

    My problem is that when the connection is firstly opened, the listener will get all the data in my target firebase node. After opened, the listener works as expected, that update the DB will only send back the changed content, via my "put" listener.

    I wonder if this is a standard SSE behavior, or it's determined by Firebase, or there are some setting i can change in bestHTTP?
    Thanks!

    Firebase REST SSE https://firebase.google.com/docs/reference/rest/database#section-streaming
    My code:

    Code (CSharp):
    1.     void Init(){
    2.         var eventSource = new EventSource(new Uri("https://{}.firebaseio.com/TestChatRoom.json"), 1);
    3.         eventSource.On("put", OnPut);
    4.         eventSource.Open();
    5.     }
    6.     void  OnPut(EventSource source, Message msg){
    7.         DebugLog(string.Format("OnPut: <color=yellow>{0}</color>", msg.Data.ToString()));
    8.     }
     
  38. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @NAXS It must be firebase's behavior. SSE itself doesn't control what the server sends (it could however through the uri's query parameters), it just connects to the server and processes what it receives.
     
  39. NXTech

    NXTech

    Joined:
    Jul 1, 2018
    Posts:
    2
    Thanks @BestHTTP . You're right, I can use the query parameters with SSE.
    Here is the code works for me.

    Code (CSharp):
    1. void Init(){
    2.    var eventSource = new EventSource(new Uri("https://{}.firebaseio.com/TestChatRoom.json?orderBy=%22$key%22&limitToLast=20"), 1);
    3.    eventSource.On("put", OnPut);
    4.    eventSource.Open();
    5. }
    6. void  OnPut(EventSource source, Message msg){
    7.    Debug.Log(msg.Data.ToString());
    8. }
     
    BestHTTP likes this.
  40. Zenithin

    Zenithin

    Joined:
    Jun 7, 2016
    Posts:
    34
    @BestHTTP
    when sending a json as string from standalone build. It sometimes corrupts the string when it reaches the server. This is a really worrisome bug.

    It turns the string into something like this upload_2020-12-29_0-56-7.png

    It does not happens in editor but only on a windows build and is intermittent like one in a few hundred messages.

    I am using JsonUtility.ToJson to convert the object into json which prints fine on the unity console before sending.
    While the receiver (Node js websocket server) received a botched up string as in above image.
     
  41. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @Zenithin

    What version of the plugin are you using? Is this is over a pure websocket connection (so it's not Socket.IO protocol using the websocket transport)? How larege are these json messages?

    As a workaround disabling BufferPool might help:
    Code (CSharp):
    1. BufferPool.IsEnabled = false;
     
  42. Zenithin

    Zenithin

    Joined:
    Jun 7, 2016
    Posts:
    34
    @BestHTTP
    It is not using socket io.
    It connects to a node js server created with ws library.
    I will try this buffer pool setting.
    Message size is as shown in image string messages of that much length. Even bigger messages pass through at times and then it would just break at any of the message randomly.

    we are using 2.1.0 version of plugin it seems
     
    Last edited: Dec 28, 2020
  43. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @Zenithin

    I would suggest to update the plugin too. In v2.2.1 I found and fixed a possible frame corruption bug that might be the one you affects you.
     
  44. Zenithin

    Zenithin

    Joined:
    Jun 7, 2016
    Posts:
    34
    @BestHTTP
    Okie I tried that disabling the bufferedpool. The issue seems to be fixed now :). Thanks.

    I will need to see what I lose by disabling buffered amount and I wonder why it caused that. Thanks.
     
    Last edited: Dec 28, 2020
  45. gschomburgrph

    gschomburgrph

    Joined:
    Dec 7, 2018
    Posts:
    1
    You should mention the other Socket Io custom encoders in the docs as well; maybe here . I was trying to make my own Newtonsoft and you already had one. Super work by the way.
     
  46. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @gschomburgrph Thanks, that's a great idea indeed! Just added more documentation about these there.
     
  47. CAREFiSH

    CAREFiSH

    Joined:
    May 28, 2013
    Posts:
    8
  48. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @CAREFiSH How your server side looks like? As i see the MessagePack serializer couldn't deserialize the server's response.
     
  49. CAREFiSH

    CAREFiSH

    Joined:
    May 28, 2013
    Posts:
    8
    I have updated the Gist. Apologies for not including that the first time. Running ASP.NET Core with messagepack enabled with the a `services.AddSignalR().AddMessagePackProtocol();`
     
  50. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,609
    @CAREFiSH Yeah, your function on the server returns with a string, and on the client side using Invoke<Data> you tells the plugin that you expect a return value of type Data. So, it should be Invoke<string> instead.
     
unityunity