diff --git a/client/services/io.js b/client/services/io.js index f8efa884..58c6aa34 100644 --- a/client/services/io.js +++ b/client/services/io.js @@ -3,9 +3,13 @@ */ module.exports = function (app) { - var socket = io(); + var socket; + function init(){ + socket = io(); + } - app.service("io", function(){ + app.service("io", function () { + if (!socket) init(); return socket; - }) + }); }; \ No newline at end of file