connect method
Implementation
DataConnection connect(String peer, {PeerConnectOption? options}) {
if (disconnected) {
logger.warn(
'You cannot connect to a new Peer because you called .disconnect() on this Peer and ended your connection with the server. You can create a new Peer to reconnect, or call reconnect on this peer if you believe its ID to still be available.',
);
emitError(
PeerErrorType.Disconnected,
'Cannot connect to new Peer after disconnecting from server.',
);
throw Exception(
'Cannot connect to new Peer after disconnecting from server.',
);
}
final dataConnection = DataConnection(peer, this, options);
_addConnection(peer, dataConnection: dataConnection);
return dataConnection;
}