doghappy / socket.io-client-csharp

socket.io-client implemention for .NET
MIT License
729 stars 125 forks source link

EmitAsync #238

Open Jakobi-mirsk opened 2 years ago

Jakobi-mirsk commented 2 years ago

hi I would like to know what has been performed when the task returned by EmitAsync completes. At the moment i am waiting 5 sec. for a call to EmitAsync to complete:

               Task sendT = socket.EmitAsync(eventName, request);
                if (!sendT.Wait(5000))
                {
                    string warning = "Failed to send within specified timeout";
                    Log(warning, LogType.Warning);
                }

In my case some times it does not finish the task within the 5 sec. So i was wondering if there is any way for me to see if it was the sender or the receiver that was slow to communicate?

doghappy commented 2 years ago

Please show your SocketIOOptions and socket.io server version

Jakobi-mirsk commented 2 years ago

hi These are my options: options.Reconnection = true; options.ReconnectionAttempts = int.MaxValue; options.ReconnectionDelay = 1000; options.ReconnectionDelayMax = 5000; options.RandomizationFactor = 0.5;

the server is using "socket.io": "^4.1.3"

doghappy commented 2 years ago

I don't know how to reproduce it, can you help me?


I tried to run a socket.io server on localhost, and emit 11k data each time. but failed to reproduce it.

Jakobi-mirsk commented 2 years ago

hi I don't think it is a problem with the API. I think it is either the server or the client machine that is stressed. But it would be great to know if it was the server or the client that performed poorly. But the more I think about it, I don't think it is an information that can be extracted by any API. It is something that has to be investigated via performance monitor in the individual machines. But it would be nice to know if calling the EmitAsync is performing the socket send operation or if it is putting the request in a queue to be send?

doghappy commented 2 years ago

It is sent directly by the socket, and there is no queue to buffer the message.

Jakobi-mirsk commented 2 years ago

okay thank you. Have a nice day.