ChalonaSocketIOWebConnect function

Future<ChalonaSocketIO> ChalonaSocketIOWebConnect(
  1. String url
)

Implementation

Future<ChalonaSocketIO> ChalonaSocketIOWebConnect(String url) async {
  var r = ChalonaSocketIO((bind) {
    // var ws = window.WebSocket(url);

    // //hablandole al socket
    // ws.onMessage.listen((event) {
    //   try {
    //     Map<String, dynamic> json = jsonDecode(event.data.toString());
    //     if (json.containsKey('channel')) {
    //       bind.emit(json);
    //     }
    //   } catch (e) {
    //     console.error(
    //         'ChalonaSocketIOWeb: el mensaje que llega del servidor no contiene canal');
    //   }
    // });

    // // escuchando al socket
    // bind.listen((data) {
    //   ws.send(jsonEncode(data) as JSAny);
    // });

    // // si se cierra la conexion
    // ws.onClose.listen((event) {
    //   ws.send(jsonEncode({'channel': 'disconnect'}) as JSAny);
    // });
  });

  return r;
}