The whole initialization of this project is written inside a single function called init(). Let's take a look at all the things inside this function.
The first part of the code connects to rosbridge_server if it is running. The following code snippet does this:
var ros = new ROSLIB.Ros({ url : 'ws://localhost:9090' });
As you can see, we are creating an object of ROSLIB.Ros for communicating with rosbridge_server. When this code runs, it will connect to rosbridge_server, which is listening on ws://localhost:9090. Instead of running both on the same system, we can provide the IP address of the system that is running ROS and rosbridge_server.