var events = require("events");
var io = require('socket.io-client');

var Receiver = function () {};
Receiver.prototype = new events.EventEmitter;

Receiver.prototype.connect = function() {
  var self = this;
  var socket = io.connect(window.location.href);
  console.log('Connected to socket server: ' + window.location.href);
  
  socket.on('pulse', function(data) {
    console.log('Receiver: Received pulse');
    self.emit('pulse', data);
  });

  socket.on('pulsar control', function(data) {
    console.log('Receiver: Received control pulse');
    self.emit('pulsar control', data);
  });

  socket.on('pulse update', function(data) {
    console.log('Receiver: Received update pulse');
    self.emit('pulse update', data);
  });
}

module.exports = Receiver;
@@ -190,98 +190,218 @@
 %7B%0A  
-var self = this;%0A  var socket = io.connect(window.location.href);%0A  console.log('Connected
+console.log('Attempting to connect socket.io to socket server: ' + window.location.href);%0A  var socket = io.connect(window.location.href);%0A%0A  socket.on('connect', data =%3E %7B%0A    console.log('CONNECTED: socket.io
  to 
@@ -444,16 +444,19 @@
 ref);%0A  
+%7D)%0A
 %0A  socke
@@ -465,38 +465,31 @@
 on('pulse', 
-function(
 data
-)
+ =%3E
  %7B%0A    conso
@@ -520,36 +520,36 @@
 ed pulse');%0A    
-self
+this
 .emit('pulse', d
@@ -591,30 +591,23 @@
 ntrol', 
-function(
 data
-)
+ =%3E
  %7B%0A    c
@@ -650,36 +650,36 @@
 ol pulse');%0A    
-self
+this
 .emit('pulsar co
@@ -732,22 +732,15 @@
 e', 
-function(
 data
-)
+ =%3E
  %7B%0A 
@@ -798,12 +798,12 @@
     
-self
+this
 .emi
@@ -862,8 +862,9 @@
 eceiver;
+%0A

Improve logging messages and simplify functions in Reciever