I am building a real time chat application on flutter and using flutter_socket_io: ^0.6.0.
Problem:
When I run my app in Android I am getting the following error in logs.
D/FlutterSocketIoPlugin: SocketIO(30708): connect_error: [{“detailMessage”:“timeout”,“stackTrace”:[],“suppressedExceptions”:[]}]
D/FlutterSocketIoPlugin: SocketIO(30708): reconnect_error: [{“cause”:{“detailMessage”:“timeout”,“stackTrace”:[],“suppressedExceptions”:[]},“detailMessage”:“Connection error”,“stackTrace”:[],“suppressedExceptions”:[]}]
D/FlutterSocketIoPlugin: SocketIO(30708): connect_timeout: [20000]
D/FlutterSocketIoPlugin: SocketIO(30708): reconnect_attempt: [23]
D/FlutterSocketIoPlugin: SocketIO(30708): reconnecting: [23]
Here is my source code
@override
void initState() {
super.initState();
_connectSocket01();
}
_connectSocket01() {
//update your domain before using
//, query: "", socketStatusCallback: _socketStatus
socketIO = SocketIOManager().createSocketIO(SOCKET_URL, "/");
//call init socket before doing anything
socketIO.init();
//subscribe event
socketIO.subscribe('user-global-1:new_message', (jsonData) {
print("You have a new message");
});
//connect socket
socketIO.connect();
}
Note: My socket IO server is running with https but In flutter socket IO is going on reconnecting continuously.
Kindly help how can I fix this error.