start method

  1. @override
Future<void> start()
override

Start starts the identify service.

Implementation

@override
Future<void> start() async {
  // Initialize event emitters
  _evtPeerProtocolsUpdated = await host.eventBus.emitter(EvtPeerProtocolsUpdated);
  _evtPeerIdentificationCompleted = await host.eventBus.emitter(EvtPeerIdentificationCompleted);
  _evtPeerIdentificationFailed = await host.eventBus.emitter(EvtPeerIdentificationFailed);

  // Register as a network notifiee
  host.network.notify(_NetNotifiee(this));

  // Set stream handlers
  host.setStreamHandler(id, handleIdentifyRequest);
  host.setStreamHandler(idPush, handlePush);

  // Update snapshot
  _updateSnapshot();

  // Mark setup as completed
  _setupCompleted.complete();

  // Start listening for events
  await _startEventLoop();
}