You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and my socket server version is "socket.io": "2.0.4"(also try with "2.3.0") on the nodejs server.
now issue: the client cant conn to the server. but if transports replace with 'transports': ['websocket'],it work ok.so how to fix it in my project? thx very much!
The text was updated successfully, but these errors were encountered:
Are you using it in Flutter env.? if so, there is no dart:html api available in Flutter, so it can only work with websocket transports in either dart:html (for Web) or dart:io(for Flutter).
Hi guys:
in my client as below:
import 'dart:async';
import 'package:socket_io_client/socket_io_client.dart' as IO;
main() {
IO.Socket socket = IO.io('http://127.0.0.1:8090/xy', <String, dynamic>{
'transports': ['polling','websocket'],
'extraHeaders': {'foo': 'bar'}
});
socket.on('connect', () {
print('socket_io_client===>connect http://127.0.0.1:8090/xy');
socket.emit('msg', 'init');
int count = 0;
new Timer.periodic(const Duration(seconds: 20), (Timer countDownTimer) {
socket.emit('msg', count++);
});
});
socket.on('event', (data) => print(data));
socket.on('disconnect', () => print('disconnect http://127.0.0.1:8090/xy'));
socket.on('fromServer', () => print());
}
pubspec.yaml
#socketIO
socket_io_common: ^0.9.0+5
socket_io_client:
git:
url: https://github.com/rikulo/socket.io-client-dart
and my socket server version is "socket.io": "2.0.4"(also try with "2.3.0") on the nodejs server.
now issue: the client cant conn to the server. but if transports replace with 'transports': ['websocket'],it work ok.so how to fix it in my project? thx very much!
The text was updated successfully, but these errors were encountered: