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

Slow and sometimes disconnect by itself

Open codetinker opened this issue 3 years ago • 5 comments

Hi,

socket_io_client: ^2.0.0-beta.3 && 2.0.0-beta.3-nullsafety.0 Im using flutter 2.0.4

I notice connection sometime disconnect by it self and reconnect again. This happened at random. And i notice when i send request to nodejs server, it receive immediately, but from nodejs server response back to flutter. it is very slow. less than 1 sec to request. receive response 7-10 seconds.

IO.Socket socket = IO.io('https://api.domain.com', <String, dynamic>{ 'secure': true, 'forceNew': true, 'autoConnect': true, 'path': '/sio/socket.io', 'timeout': 30000, 'reconnect': true, 'transports': <String>['websocket', 'xhr-polling'] });

codetinker avatar Apr 16 '21 17:04 codetinker

Nodejs socket.io, I have tested ver 4.0.1, 4.0.0 and 3.1.2 Its all the same.

codetinker avatar Apr 16 '21 18:04 codetinker

me too

holland-hng avatar Apr 17 '21 14:04 holland-hng

any solution to fix it?

liangbsu avatar May 22 '21 01:05 liangbsu

+1

hatemragab avatar May 27 '21 21:05 hatemragab

I manage to speed up receiving data at client by JSON.stringify(dataToSend) it first. Before the client is receiving object(Map) or array(List). the bigger the data in object/array, the slower the client to process.

But after I stringify the data, I noticed quite significant less time for the client to receive and display the data. Hope this helps.

I'm still monitoring random disconnect. Hope this is related.

codetinker avatar May 30 '21 23:05 codetinker