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:
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 ...