import { Node } from "@counterfactual/types" ; import { EventEmitter } from "events" ; export class MemoryMessagingService implements Node . IMessagingService { private readonly eventEmitter : EventEmitter = new EventEmitter ( ) ; constructor ( ) { } async send ( to , msg ) { this . eventEmitter . emit ( to , msg ) ; } onReceive ( address , callback ) { this . eventEmitter . on ( address , msg => { callback ( msg ) ; } ) ; } }