getConnection method

dynamic getConnection(
  1. String peerId,
  2. String connectionId
)

Retrieve a data/media connection for this peer. */

Implementation

dynamic getConnection(String peerId, String connectionId) {
  if (!_connections.containsKey(peerId)) {
    logger.error("Could not get connection with id: $peerId");
    return null;
  }
  final connections = _connections[peerId];

  if (connections != null) {
    for (final connection in connections) {
      if (connection.connectionId == connectionId) {
        return connection;
      }
    }
  }

  return null;
}