diff --git a/lib/dispatcher/nopeDispatcher.ts b/lib/dispatcher/nopeDispatcher.ts index 84169dd..0527ae2 100644 --- a/lib/dispatcher/nopeDispatcher.ts +++ b/lib/dispatcher/nopeDispatcher.ts @@ -832,7 +832,7 @@ export class nopeDispatcher implements INopeDispatcher { // Subscribe to the availableServices of Remotes. // If there is a new Service => udpate the External Services - this.communicator.onNewServicesAvailable((data) => { + await this.communicator.onNewServicesAvailable((data) => { try { if (data.dispatcher !== _this.id) { _this._mappingOfRemoteDispatchersAndServices.set( @@ -853,7 +853,7 @@ export class nopeDispatcher implements INopeDispatcher { }); // Subscribe to new available Topics. - this.communicator.onNewObservablesAvailable((data) => { + await this.communicator.onNewObservablesAvailable((data) => { try { if (data.dispatcher !== _this.id) { _this._mappingOfRemoteDispatchersAndPropsOrEvents.set( @@ -873,7 +873,7 @@ export class nopeDispatcher implements INopeDispatcher { } catch (e) {} }); - this.communicator.onNewInstanceGeneratorsAvailable((data) => { + await this.communicator.onNewInstanceGeneratorsAvailable((data) => { try { _this._mappingOfRemoteDispatchersAndGenerators.set( data.dispatcher, @@ -891,14 +891,14 @@ export class nopeDispatcher implements INopeDispatcher { } catch (e) {} }); - this.communicator.onStatusUpdate((info) => { + await this.communicator.onStatusUpdate((info) => { _this._externalDispatchers.set(info.id, info); _this.externalDispatchers.setContent( Array.from(_this._externalDispatchers.values()) ); }); - this.communicator.onBonjour((info) => { + await this.communicator.onBonjour((info) => { _this._externalDispatchers.set(info.id, info); _this.externalDispatchers.setContent( Array.from(_this._externalDispatchers.values()) @@ -919,12 +919,12 @@ export class nopeDispatcher implements INopeDispatcher { } }); - this.communicator.onAurevoir((dispatcher: string) => + await this.communicator.onAurevoir((dispatcher: string) => _this._removeDispatcher(dispatcher) ); // Listen to newly created instances. - this.communicator.onNewInstancesAvailable((message) => { + await this.communicator.onNewInstancesAvailable((message) => { // Store the instances: _this._mappingOfRemoteDispatchersAndInstances.set( message.dispatcher, @@ -944,7 +944,7 @@ export class nopeDispatcher implements INopeDispatcher { } }); - this.communicator.onTaskCancelation((event) => { + await this.communicator.onTaskCancelation((event) => { if (event.dispatcher !== _this.id) { _this.canceledTask.setContent(event); } @@ -953,7 +953,7 @@ export class nopeDispatcher implements INopeDispatcher { if (this._logger) { this._logger.info("initialized"); } - this.communicator.emitBonjour(this._genAliveMessage()); + await this.communicator.emitBonjour(this._genAliveMessage()); this.ready.setContent(true); }