socket.io-client-dart
socket.io-client-dart copied to clipboard
disconnect issue : Closure: (dynamic) => Null
everytime when I try to connect with server with socket.io. The socket.io will show the disconnect status and error :Unhandled Exception: Converting object to an encodable object failed: Closure: (dynamic) => Null, the error was located at package:socket_io_common/…/parser/parser.dart
// json data if (null != obj['data']) { str += json.encode(obj['data']); }
after this, socket.io will connect success. I don't understand why it happened like this,here is my code
Map<String,dynamic> query = {
};
query.addAll(_params);
_channel = IO.io(_url, IO.OptionBuilder()
.setQuery(query)
.setTransports(['websocket'])
// .disableAutoConnect()
.enableForceNewConnection()
.build());
_channel.onConnect((data){
isConnected = true;
if(data != null){
debugPrint('socket successs ******************:$data');
}
});
_channel.onError((data){
debugPrint('error:$data');
});
_channel.onConnectError((data){
debugPrint('connect_error:$data');
_channel.connect();
});
_channel.onDisconnect((data){
// String info = _decoder.convert(data);
debugPrint('disconnect======$data');
_channel.connect();
});
same !!!!
which version are you using?
My case was a server-side error I assume ,after I spend a day searching , it got fixed all by itself but we switched to server v2* Client v*1
@jumperchen hi there, I use the 1.0.2, My flutter verison is 2.8.1
@wupengbigMarker which Socket server version are you using? v2.*
, v3.*
, or v4.*
?
@wupengbigMarker which Socket server version are you using?
v2.*
,v3.*
, orv4.*
? v2*
sorry, do I have to upgrade socket server @jumperchen
@wupengbigMarker from the info. - https://github.com/rikulo/socket.io-client-dart#version-info, it should be okay, do you have any reproducable example?
My case was a server-side error I assume ,after I spend a day searching , it got fixed all by itself but we switched to server v2* Client v*1
hey,bro how did you fix it
im getting this issues. did any one solve it ?