inicializaEscucha method

Future<void> inicializaEscucha({
  1. required String idChannel,
  2. required String token,
  3. required String endpointSocket,
})

Implementation

Future<void> inicializaEscucha({
  required String idChannel,
  required String token,
  required String endpointSocket,
}) async {
  try {
    if (!_channels.containsKey(endpointSocket)) {
      await _initSocket(token, endpointSocket);
    }

    WSocketDataProvider.logDebug(
        'debugLogin _onInicializaEscucha...... $idChannel...$endpointSocket');

    if (idChannel.isEmpty) {
      throw 'El idChannel no puede estar vacio';
    }

    lstIdChannel[endpointSocket] ??= [];
    lstIdChannel[endpointSocket]!.add(idChannel);

    _sendJoinRoom(endpointSocket, idChannel);
  } catch (error) {
    WSocketDataProvider.logDebug('Error en inicializaEscucha: $error');
  }
}