initialize method
Initializes the lifecycle, preparing it for use.
Implementation
@override
Future<void> initialize() async {
if (_initialized) return;
config.validate(throwOnError: true);
final nodeUId = _localNodeUId;
if (nodeUId == null) {
throw StateError(
'WebSocketTransport has no node identity. It is set by PeerSession '
'before initialize(); a transport driven directly must set '
'localNodeUId first.',
);
}
await _connection.connect(timeout: config.connectTimeout, nodeUId: nodeUId);
_initialized = true;
}