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 send messages

The first service we will create is the service to send messages. This message can be sent to a single user (private) or to all users (broadcast).

Our service will have the following signature:

sendMessage(payload); 

This service does not have a return, and it receives only one parameter which is mandatory:

  • payload: This is an object containing the message to be sent; it must have up to three properties:
    • from: This property is mandatory, it is a string representing the user sending the message
    • content: This property is mandatory, it is a string representing the content of the message
    • to: This property is optional, it is a string representing the receiver of the message; if it is omitted, the message is sent to ...

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