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

Connecting user interactions and server communication

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

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