Now we must implement the observables to listen to user input; they are going to be used to send messages to the server.
Let's implement the events.js file inside the client folder.
The first thing to do is to use the RxJS module:
var Rx = require('rx');
We want to send the user messages every time the user hits the Send message button or when the user hits enter in the message box.
For this reason, we need two observables, the first to trigger when the user clicks on the Send message button:
var sendPressedObservable = Rx.Observable .fromEvent(document.getElementById('send_message'),'click');
This observable is simple and just propagates the event whenever the user clicks on the button.
The second observable ...