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 a command

The last service we will implement will be a service to execute a command. On several web chats you can pass commands using the slash (/) character at the beginning of the message. Each web chat has its own implementation, and they can perform different actions such as kick another user, ban a user, send a GIF for every user, show the current time, and so on.

In our service to send a command, we will implement two different and simple commands: the first command will generate a random number between 1 and 6 and will be called roll_a_dice; the other command will be called echo and it will just send back the message sent by the user.

Our service will have the following signature:

    command(payload);

It will receive ...

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