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 to the server application

We are going to use WebSockets to connect with the server through the socket.io-client. On the server we modeled, connections and requests as observable objects and we will do the same on the client, To do so, open the connection.js file inside the client folder, and import the modules that we are going to use:

var Rx = require('rx'); var io = require('socket.io-client');

So far we have only imported the rx module, which we will use to create the observables, and the socket.io-client, which we will use to start the connection.

We will not use ES6 on the client, to avoid the extra step of transpiling it to ES5 and making it work on all major browsers.

Now we need to connect to the server. As we are running ...

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