From 3d35d44c3feda39b43b4e0d1dbfc8ffcf89942c6 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 10 Sep 2014 15:17:43 -0400 Subject: [PATCH] realtime improvement --- app/assets/javascripts/metamaps/Metamaps.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/metamaps/Metamaps.js b/app/assets/javascripts/metamaps/Metamaps.js index 22af697d..9288d125 100644 --- a/app/assets/javascripts/metamaps/Metamaps.js +++ b/app/assets/javascripts/metamaps/Metamaps.js @@ -1414,7 +1414,7 @@ Metamaps.Realtime = { }); $('body').click(self.close); - self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); + self.socket = io.connect('http://localhost:5001'); self.startActiveMap(); }, toggleBox: function (event) { @@ -1462,15 +1462,12 @@ Metamaps.Realtime = { } } - if (!self.socket) { - self.socket.on('connect', function () { - start(); - }); - } - else if (self.socket) { + if (!self.socket.connected) { self.socket.socket.connect(); - start(); } + self.socket.on('connect', function () { + start(); + }); }, endActiveMap: function () { var self = Metamaps.Realtime;