Ui.service.ts

@Injectable()
export class UiService {
  private brotherMessage = new Subject<string>();
  public brotherMessage$ = this.brotherMessage.asObservable();

  private sisterMessage = new Subject<string>();
  public sisterMessage$ = this.sisterMessage.asObservable();

  constructor() {}

  brotherSpeak(message: string): void {
    this.brotherMessage.next(message);
  }

  sisterSpeak(message: string): void {
    this.sisterMessage.next(message);
  }
}