I'm trying to add chat functionality in my app using socket_io_client plugin but Unable to connect to the socket. it neither throws error or nor exception . In fact not printing response after get connection . so I'm confused, it connected or not? and I'm not familiar with socketIO, means I never did it before .
Dunno what am I doing wrong .
Piece of Code:
import 'package:socket_io_client/socket_io_client.dart' as IO;
@override
void initState() {
super.initState();
_messageController = TextEditingController();
_controller = ScrollController();
connectSocket();
}
connectSocket() async {
print('Connecting to chat service');
socket = IO.io('http://....', <String, dynamic>{
'transports': ['websocket'],
'autoConnect': false,
});
socket.connect();
socket.on('connection', (data) {
print('connect:$data');
});
}