Riptide icon indicating copy to clipboard operation
Riptide copied to clipboard

Client.Connect Lag

Open mblogest opened this issue 5 months ago • 1 comments

Hi. i use unity 6 i have Problem With connect function lag rpitide 2.2.0 Image

mblogest avatar May 30 '25 22:05 mblogest

Deep profile it and see what exactly inside the Connect call is causing it.

tom-weiland avatar May 31 '25 02:05 tom-weiland

hi

in Client.cs

public bool Connect(string hostAddress, int maxConnectionAttempts = 5, byte messageHandlerGroupId = 0, Message message = null, bool useMessageHandlers = true)
     


if (useMessageHandlers)
                CreateMessageHandlersDictionary(messageHandlerGroupId);

must change to

   
  if (useMessageHandlers && (messageHandlers == null || messageHandlers.Count == 0))
            {
                CreateMessageHandlersDictionary(messageHandlerGroupId);
            }

mblogest avatar Aug 09 '25 02:08 mblogest

That would just make the allocations only happen on the first Connect call though, which is where it's arguably the most important to avoid/reduce them...

tom-weiland avatar Aug 09 '25 23:08 tom-weiland