socket.io lazy init;
This commit is contained in:
1 parent
534ce3f2e3
commit
d6fbeb1fd0
1 file changed
+7
-3
@@ -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;
|
||||
})
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user