Now that we have already implemented the observable to listen to user interactions and also a way to communicate with the server, we must now implement three things:
- A way for the user to provide their name
- Send messages to the server when a user wishes
- Show on the screen the incoming messages from the server
To implement this last part of our application that connects the user interactions with the server, we are going to implement the index.js file located in the client folder.
The first thing to implement this is to require the modules we need:
var Rx = require('rx');
var connection = require('./connection');
var events = require('./events');
With these three lines of code we require the RxJS module and the connection and events modules. Now we can ask a user for their name, and we will use a prompt for this:
var logged =...