From d6fbeb1fd04bb330bddc54a32b88346c820b93e6 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Mon, 13 Jul 2015 01:14:27 +0300 Subject: [PATCH] socket.io lazy init; --- client/services/io.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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