O'Reilly logo

Mastering Reactive JavaScript by Erich de Souza Oliveira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Service to listen to new messages

Our next service will be used to listen to new messages. It must return an observable containing the data, the destination of which is the given user.

Our service will have the following signature:

    listenToMessages(payload,[observable]);

It receives two parameters, but only the first is mandatory:

  • payload: It is an object containing information about the user, and it must have one property:
    • me: This property is mandatory - it is a string representing the user listening to messages
  • observable: It is the observable where messages are pushed

Our service must implement the following rules:

  • Must return an observable containing only data for the given user, which means messages sent by the given user, private ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required