socket.io-client-csharp icon indicating copy to clipboard operation
socket.io-client-csharp copied to clipboard

EmitAsync

Open Jakobi-mirsk opened this issue 4 years ago • 6 comments

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?

Jakobi-mirsk avatar Nov 16 '21 15:11 Jakobi-mirsk

Please show your SocketIOOptions and socket.io server version

doghappy avatar Nov 17 '21 02:11 doghappy

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"

Jakobi-mirsk avatar Nov 17 '21 08:11 Jakobi-mirsk

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.

doghappy avatar Nov 18 '21 08:11 doghappy

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?

Jakobi-mirsk avatar Nov 18 '21 08:11 Jakobi-mirsk

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

doghappy avatar Nov 18 '21 08:11 doghappy

okay thank you. Have a nice day.

Jakobi-mirsk avatar Nov 18 '21 09:11 Jakobi-mirsk